How to Change a Password in a PowerShell

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

PowerShell is a Microsoft networking tool used to run scripts on your client computers. These scripts run each time your users log in to the Windows network. You can edit these scripts using a simple text editor such as Microsoft Notepad. The PowerShell application runs on your network server, so the user's login account is tied to the new scripts. You can use PowerShell scripts to change the local administrator password to ensure each computer has the same password.

Skill level:


  1. 1

    Right-click the script on the server and select "Open With." In the list of programs, choose PowerShell or Notepad. Either program lets you edit the script file's code.

  2. 2

    Set up the domain variable. You must specify the domain of which the user is a part. Type the following code into the file code:

    $OU = "YourDomName/YourOu"

    Replace "YourDomName" with your domain name and "YourOu" with the computer's name.

  3. 3

    Copy and paste the following code into your shell script:

    get-QADUser -search Root $OU -search Scope 'OneLevel' | `

    Where-Object {$_.description -like "administrator*"} | `

    set-QADUser -user Password "Lapt00p$" `

    -what If

    This code changes the password for your administrator account.

  4. 4

    Click the "File" menu item and click "Save." This saves the changes to your script.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.