To enable a local user account in PowerShell, use the `Enable-LocalUser
` command. This command enables local user accounts.
Here, is the PowerShell code to enable a local user account.
Enable-LocalUser [-Name] <String[]> [-SID] <SecurityIdentifier[]> [-InputObject] <LocalUser[]>
When a user account is disabled, the user can not log on. When a user account is enabled, the user can log on.
In this article, we will discuss how to enable a local user account using the PowerShell Enable-LocalUser command.
Enable Local User Account Using PowerShell
To enable a local user account in PowerShell, use the Enable-LocalUser
cmdlet with the Name parameter to specify the local user account name,
Enable-LocalUser -Name "nathan"
In the above PowerShell script, the Enable-LocalUser
cmdlet enables the local user account name specified by the Name
parameter “nathan“.
To check if the user account is enabled or not, use the Get-LocalUser
command as given below.
Get-LocalUser -Name "nathan"
The output of the above PowerShell script gets the local user account details including his name, enable status, and description.
Conclusion
I hope the above article on how to use the Enable-LocalUser
command in PowerShell to enable a local user account is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.