Changing Admin password on Windows systems using Powershell.


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")
   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.


Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

Azure VMware Solution: NSX-T Active/Active T0 Edges...but