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

Misc: Navien NPE-240A Navilink App missing scheduling function

Macbook Pro OSX 10.5.x Sprint Blackberry 8830 Data Tethering

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