Hi
Can anyone help me with a powershell script to monitor the Password expiry date for the Members of a AD group.
I tried below script which gives me the output but it also gives me "Get Output Failed" error.
Import-Module ActiveDirectory;
$MaxPwdAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge.Days;
$expiredDate = (Get-Date).addDays(-$MaxPwdAge);
$Groups=Get-ADGroupMember "<Name of Group>" -Recursive | Get-ADUser -Properties Name, msDS-UserPasswordExpiryTimeComputed,PasswordLastSet | select Name, samaccountname, PasswordLastSet, @{name = "DaysUntilExpired"; Expression = {$_.PasswordLastSet - $ExpiredDate | select -ExpandProperty Days}} | Sort-Object PasswordLastSet;
Write-Output $($Groups);
exit 0;