Link to home
Start Free TrialLog in
Avatar of MilesLogan
MilesLoganFlag for United States of America

asked on

Powershell - How to set multiple accounts to change password at next logon

Hi EE

I am not having any luck using the -ChangePasswordAtLogon  option or even if its the correct option to use .

I need to add hundreds of SamAccountNames to a .txt file and force those accounts to
change the password at next logon.
SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok tested

get-content c:\users.txt | foreach-object {set-aduser $_ -ChangePasswordAtLogon $true}

Thanks

Mike
nice using the alias for "foreach-object"
Avatar of MilesLogan

ASKER

I was close !!  I am in the right ball park at least :)

Thank you both so much !