The user's account has expired - Microsoft Windows - Workgroup
This post describes how to resolve the error "The user's account has expired" on a Microsoft Windows Workgroup machine i.e. without Active Directory Users and Computers.
Cause
This error can occur when the local user account's expiry date is in the past and you try to logon as that user.
Resolution
You can't use Local Users and Groups to change the user account expiry date.
The expiry date can be be changed using either Powershell or VBScript.
PowerShell method
To get the current expiry date, run the following command in PowerShell, replacing accountname with the account you want to get.
Get-LocalUser accountname|SELECT *
To set the expiry date to a specified date:
Set-LocalUser asmith -AccountExpires (Get-Date).AddDays(12)
To set the expiry date to never expire:
Set-LocalUser accountname -AccountNeverExpires
VBScript method
The following VBScript gets the current expiry date:
Set objUser = GetObject("WinNT://hostname/accountname")Wscript.Echo objUser.Name, objUser.AccountExpirationDate
To increment the expiry date by 60 days:
Set objUser = GetObject("WinNT://hostname/accountname")objUser.AccountExpirationDate = Date + 60objUser.SetInfoWscript.Echo objUser.Name, objUser.AccountExpirationDate
My VBScripts are based on information from this excellent post: https://devblogs.microsoft.com/scripting/how-can-i-configure-an-expiration-date-for-a-local-user-account/
Comments
Post a Comment