Avatar of c7c4c7
c7c4c7
Flag for United States of America asked on

Powershell script to force password change

Using Powershell, on a win 7 pro and Win8 home machine, workgroup not a domain, how do I force a user to change their password?

Please include the code
Powershell

Avatar of undefined
Last Comment
c7c4c7

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rainer Jeschor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Will Szymkowski

You can also reference some examples for this on powershell.com. See link below...
http://powershell.com/cs/forums/t/15101.aspx

Will.
c7c4c7

ASKER
I thought Active Directory and its components were server only.
c7c4c7

ASKER
The code supplied
$usr=[ADSI]'WinNT://localhost/TheUserLogonName'  
$usr.passwordExpired = 1  
$usr.setinfo()  

On Win 7 Pro although it does not flag any error does not require the user to reset their password, I did replace the TheUserLogonName with the correct user name.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
c7c4c7

ASKER
Take two - The userid was set to password never expires which apparently overrides the request to force the password reset
c7c4c7

ASKER
Cannot use it in Win 8 Home, cannot force password change in Win 8 Home