Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

Timon

Reviews(1)
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?