How to Enable Admin account by user account with powershell ise

Hello everyone!

How to enable admin account by local user account.

Earlier, I disabled the existing Admin account with admin rights.


Enable-LocalUser Administrator

Should do the trick, provided the account running it has the necessary access to do so. I think Windows always ensures at least one administrative account is active at any given time, usually.

Thank you,

but user account have a not permission for this.

[PS C:> Enable-LocalUser Administrator

Enable-LocalUser : Access denied.

At line:1 char:1

  • Enable-LocalUser Administrator

  • CategoryInfo : PermissionDenied: (Administrator:LocalUser) [Enable-LocalUser], AccessDeniedE


  • FullyQualifiedErrorId : AccessDenied,Microsoft.PowerShell.Commands.EnableLocalUserCommand]

You will need to execute the cmdlet with an account that has administrative privileges on the computer.

Thank you to provide your opinion,

but can you show cmdlet which I need to write.

I can give you a hint, If you know PowerShell, you should be able to identify what cmdlets can do run as kind off… else please take the time to learn PowerShell and will be one of the best investment you have ever done.

Get-Command -ParameterName Credential