Author Posts

October 20, 2017 at 9:04 pm

Hello Good folks,

I spun up an EC2 windows instance. Using the following powershell script, I tried to change the password of the Adminstrator. I am using ADSI (active directory service interface) in the command below.

This doesn't work. Any suggestions are greatly appreciated. Thanks much

"Powershell.exe ([adsi]\\\"WinNT://$env:computername/Administrator\\\").SetPassword('",{ "Ref": "LocalAdminPassword"},"')"

October 21, 2017 at 1:52 am

I love me some PoSH, but sometimes old school is just more straight forward.
Why not just use Net User.

net user administrator

Or if you really want to stick with ADSI, then, try this...

([adsi]"WinNT://$env:COMPUTERNAME/$env:USERNAME").SetPassword("Whatever password you choose")

You can wrap that in a PoSH script even, if you 'd like.