How to Enable Admin account by user account with powershell ise

Welcome Forums General PowerShell Q&A How to Enable Admin account by user account with powershell ise

This topic contains 5 replies, has 4 voices, and was last updated by

 
Participant
1 week ago.

  • Author
    Posts
  • #113825

    Participant
    Points: 0
    Rank: Member

    Hello everyone!

    How to enable admin account by local user account.

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

     

  • #113831

    Participant
    Points: 1
    Rank: Member
    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.

    • #113834

      Participant
      Points: 0
      Rank: Member

      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

      xception

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

  • #113932

    Participant
    Points: 0
    Rank: Member

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

    • #114010

      Participant
      Points: 0
      Rank: Member

      Thank you to provide your opinion,

      but can you show cmdlet which I need to write.

  • #114016

    Participant
    Points: 20
    Rank: Member

    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

You must be logged in to reply to this topic.