Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Cannot Set-AdUser -Manager due to "user must change password at next logon"

$
0
0

Hi.

I have about 200 users who haven't changed password yet.

I have made and testet a script that sets the Manager for all users. For some reason the script cannot find the Manager for the 200 users that have the "user must change password at next logon" set.

I also noticed that the "Get-Aduser -Identity johnDoe" returns "Cannot find an object with identity: JohnDoe under 'dc,=xxx'

However, if I remove the "user must change password at next logon" in dsa.msc + press ok and then set the "user must change password at next logon" again, then I can suddenly FIND the user with the "Get-AdUser -Identity JohnDoe".

Company policy does not allow me to remove all "user must change password at next logon" for users found with the command "Get-ADUser -Filter {pwdLastSet -eq 0} | Select-Object SamAccountName,Name". I also do not understand how powershell can return correct values here (John Doe) and and at the same time cannot find a specific user eg JohnDoe.

Any suggestions?

Regards the PS newbee


Viewing all articles
Browse latest Browse all 8583

Trending Articles