Get Password never expires enabled users details
try{
Write-Host "Gathering
Password never expires enabled users details..."
Write-Host "--------------------------------------------------------------"
#Get Password never expires accounts details
$resultPwdneverExp = Search-ADAccount
-UsersOnly -PasswordNeverExpires
$psne = $resultPwdneverExp |
Get-ADUser -Properties
* | select $selection
$psneCount = $psne.Count
$file2 = "C:\temp\$psneCount-Password_Never_Exp_$(Get-ADDomain | Select -ExpandProperty NetBIOSName).csv"
$psne | Export-Csv $file2 -NoClobber -NoTypeInformation
}
catch
{
Write-Host "Issue while Gathering Password never expires
enabled users details...: $_.Exception.Message"
}
Write-Host -ForegroundColor
Green "The
end of Password never expires report"
No comments:
Post a Comment