How to change local administrator password

This topic contains 5 replies, has 3 voices, and was last updated by  Max Kozlov 7 months, 2 weeks ago.

  • Author
    Posts
  • #68229

    Arnold
    Participant

    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

    Max Kozlov
    Participant

    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

      Arnold
      Participant

      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

    Dan Franciscus
    Participant

    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

      Arnold
      Participant

      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

    Max Kozlov
    Participant

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

You must be logged in to reply to this topic.