changing local admin password issue

hi all,

In our network, we have about 9k workstations. As a security measure, we are changing the Local Admin account’s password each 3 months.

The actual script that does this job is an old vbs that I’m trying to get rid of, and re-do the job in PS.

I tried this, but I get no error, and when I try to run as that local admin, I get an access denied, so it is obvious that the password was not changed.

Can someone tell me what I’m doing wrong?

Thanks!

$pass = convertTo-secureString -string ‘This is a test password’ -asPlainText -force

get-localUser -name ‘xxxx’ | set-localUser -password $pass

 

Hi,

Did you run powershell as an administrator?

yes I did, sorry if I forgot to mention it.

ok forget it, it was a tough week and I had a brain fart. it works perfectly.

thanks for trying.