How to change local administrator password

Welcome Forums General PowerShell Q&A How to change local administrator password

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

 
Participant
1 year, 8 months ago.

  • Author
    Posts
  • #68229

    Participant
    Points: 0
    Rank: Member

    Hi everybody

    I want to know if somebody can help me to write a script which will force an administrator to change a local administrator password without known the older password.

    Thank's 🙂 .

  • #68244

    Participant
    Points: 0
    Rank: Member

    something like this

    $user = [adsi]"WinNT://$ComputerName/$username"
    $user.SetPassword($Password)
    # may be it is needed too, can't remember. Or it need only for various user parameters
    # $user.SetInfo()
    
    • #68406

      Participant
      Points: 0
      Rank: Member

      Thank's. But when I try this, it's ask me the older password. Is it possible to change the password without knowing the older?

      Thank's and excuse me for my poor english 🙂

  • #68445

    Participant
    Points: 22
    Rank: Member

    If maintaining local admin passwords is your goal I recommend LAPS. Easy to setup and it works great in my experience.

    https://www.microsoft.com/en-us/download/details.aspx?id=46899

    • #68476

      Participant
      Points: 0
      Rank: Member

      Thank's for your reply.

      But my goal is to use powershell to force a user to change the local administrator password without knowing the older.
      In fact, our VM machines when they are build are not directly in a domain. We use IaaS in fact. so the blueprint just have an account (local administrator), and i want with a powershell script to force user to change the password without knowing the older. I want to be the only to keep this old password.

      PS: Excuse me again for my poor english.

      Thanks everybody

  • #68491

    Participant
    Points: 0
    Rank: Member

    May be you non-admin on comoputer where you try to change password ? It never ask me

The topic ‘How to change local administrator password’ is closed to new replies.