Changing Admin password on Windows systems using Powershell.

Summary:

Was looking for the method to do this, it’s pretty simple, but everyone had very detailed posts of other things they were doing (checks and balances).  Here is the key snippet to do it:

   1: #This simply gets you the object to work with.  You can replace 
   2: #'nameofcomputer' with a variable to target more systems.
   3: $admin = [adsi]("WinNT://" + nameofcomputer + "/administrator, user")
   4:  
   5: #This invokes the set password method and changed the administrator password
   6: #to Whatever1
   7: $admin.psbase.invoke("SetPassword", "Whatever1")

If you want more robust script that records data of it’s changes see here.

Comments

Popular posts from this blog

Macbook Pro OSX 10.5.x Sprint Blackberry 8830 Data Tethering

PowerCLI: The SSL connection could not be established, see inner exception.

Misc: Fire TV Stick 2 Screen Cut Off, no display adjustment option