Build precise queries to find exactly what you need
Press ESC to close
@Timon
Member Since: March 31, 2015
Favorites0
Views
Projects0
I tried this script with PasswordExpired and I found no result. When I ran: Get-ADUser -Filter * -Property PasswordExpired | Where {$_.Enabled -eq 'True' -and $_.PasswordExpired -Eq 'True'} I do get 1 result. It seems Search-ADAccount and Get-ADUser are giving different results. I tried to change the script: if($action -eq "PasswordExpired") { $command="Get-ADUser -Filter * -Property PasswordExpired | Where {$_.Enabled -eq 'True' -and $_.PasswordExpired -Eq 'True'}" $result=invoke-expression $command } else { $command="Search-ADAccount -"+$action+" -SearchBase '"+$searchBase+"' -SearchScope "+$searchScope $result=invoke-expression $command } I did not get any result with this change. How can I get the correct response for PasswordExpired accounts?
Reviewed 11 years ago