Hi.
In order to determine whether users should be deleted or not, I need an output value of "true" if "user must changepassword at next logon" has been set.
However, I cannot get it right as the get-aduser does not support variable "ChangePasswordatLogon".
Can you please help me out?
Regards
Carsten
Here´s my script so far:
$domain = Get-ADDomain | select -ExpandProperty DistinguishedName
$domainname = Get-ADDomain | select -ExpandProperty Name
$ou_adm = "ou=Admin,ou=Users,"
$admdomainou = $ou_adm+$domain
$file_adm = "Adm_users_" + $domainname + ".csv"
$path = "c:\users\xx\documents\"
Get-ADUser -Filter * -SearchBase "$admdomainou" -Properties SamAccountName, UserPrincipalName, Name, Created, lastlogondate, ChangePasswordAtLogon, enabled | Select-Object SamAccountName, UserPrincipalName, Name, Created, lastlogondate, ChangePasswordAtLogon, enabled | Export-Csv -NoType $path$file_adm