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

Cannotchangepassword option PS not working...

$
0
0

Hi

I am a PS newbie, and I have a problem

The cmd seems to be ok, and I can't understand why it dont...:-S Like I sayd Im a newbie at this.....

$user = Get-Content "c:\temp\xxx.txt" |
ForEach-Object { Set-ADUser $_ -CannotChangePassword $false }

 

What is wrong? And why is it wrong? the get-content works(only user names)

Set-ADuser works... so why is it not working?

message:

Set-ADUser : Cannot find an object with identity: '' under: 'DC=contoso,DC=local'.
At Y:\power shell\adgroupmember\cannotchangepassword_from _list.ps1:2 char:18
+ ForEach-Object { Set-ADUser $_ -CannotChangePassword $false }
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:ADUser) [Set-ADUser], ADIdentityNotFoundException
    + FullyQualifiedErrorId : Cannot find an object with identity: '' under: 'DC=terra,DC=local'.,Microsof
   t.ActiveDirectory.Management.Commands.SetADUser

 

PLEASE HELP!!:) Help me to understand why this doesnt work...:-)


Viewing all articles
Browse latest Browse all 6937

Trending Articles