Get or set local user account expiration date - PowerShell

In this post, I describe how to get or set the local user account expiry date in PowerShell.


Resolution

To get the current account expires date, run the following command in PowerShell, replacing accountname with the account you want to get.

Get-LocalUser accountname|SELECT *

Screenshot showing the user account expiry date in PowerShell


To set the expiry date to a specified date:

Set-LocalUser asmith -AccountExpires (Get-Date).AddDays(12)

Screenshot showing setting the user account expiry date in PowerShell


To set the expiry date to never expire:

Set-LocalUser accountname -AccountNeverExpires

Screenshot showing setting the user account expiry date to never expires in PowerShell

Comments

Popular posts from this blog

LG TV This app will now restart to free up more memory

LG TV Clear All Browsing History Data

LG TV turn off Quick Start in settings