On this one, I can manually run the Get-ADUser portion of the script and it runs into no errors, but returns no data.
Code: Select all
PS C:\Users\umsadmin59> Import-Module ActiveDirectory
PS C:\Users\umsadmin59> Get-ADUser -SearchBase "OU=BEC Users,DC=brilleyecenter,DC=local" -properties mail, useraccountco
ntrol, CannotChangePassword, passwordlastset, passwordneverexpires -filter * | select *, `
>> @{label="passwordage";expression={(new-timespan -end (Get-Date) -start $_.PasswordlastSet).Days}}, `
>> @{label="daysleft";expression={($MaxPasswordAgeDays - ((new-timespan -end (Get-Date) -start $_.Passwordlas
tSet).Days)) }} `
>> | where {($_.CannotChangePassword -ne $True) `
>> -and ($_.passwordneverexpires -ne $True) `
>> -and ($_.UserAccountControl -ne 514) `
>> -and ($_.mail -ne $null) `
>> }
PS C:\Users\umsadmin59>
PS C:\Users\umsadmin59>