0
votes

I'm having trouble with my script. Everytime I try it, I get this error message:

Get-ADUser cannot find an object with identity

But the user does exist. Here is how im getting all users from a specific group in my case it's "All-users":

[array]$u = Get-ADGroupMember $userset

After that getting users one by one to change password and send them email:

$u[$a] = Get-ADUser $u[$a] -Properties PasswordExpired, Enabled, PasswordNeverExpires, Mobile

code in gist.

Error screen (but it's in russian): error screen

1

1 Answers

0
votes

I have changed this line:

[array]$u = Get-ADGroupMember $userset

with this:

[array]$u = Get-ADGroup $userset | Get-ADGroupMember -recursive | Get-ADUser -properties

And it worked as i need with no errors.