Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell Get-Aduser

$
0
0

Trying to write a script that will check whether a few accounts are enabled, locked out, and return the last password reset time.  Any reason why $User.LockedOut or $_.LockedOut will not return a value?

$Users =    "USER1","USER2","USER3"

ForEach ($User in $Users) {

    Get-ADUser $User -Properties Name,sAMAccountType,Enabled,LockedOut,PasswordLastSet | Select Name,sAMAccountName,Enabled,LockedOut,PasswordLastSet | Out-Null

    # Check if account is Enabled or Disabled

    Write-Host $User.LockedOut

}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>