Forum Discussion
bikhod
Apr 16, 2020Copper Contributor
How to determine if a local account is locked?
Hi, Within minutes of searching, I was able to find the script below which determines if an Active Directory account is locked: Get-ADUser myaccount -Properties LockedOut | Select -Object Loc...
Animesh Joshi
Brass Contributor
You can use win32_userAccount WMI class to do a remote query on a computer hosting the local account you want to get lockOut status of
get-wmiObject -class win32_userAccount -computerName <remote-computer> | where-object {$_.name -like 'localAcc1*'} | select-object -property status, lockOut, SID, disabled
get-wmiObject -class win32_userAccount -computerName <remote-computer> | where-object {$_.name -like 'localAcc1*'} | select-object -property status, lockOut, SID, disabled
bikhod
Apr 29, 2020Copper Contributor
Thanks.
I tried the below on the server but it just hangs. PDB0V is the server name and SSRS is a local account on that server.
get-wmiObject -class win32_userAccount -computerName PDB0V| where-object {$_.name -like '*SSRS*'} | select-object -property status, lockOut, SID, disabled*
- Animesh JoshiMay 05, 2020Brass ContributorDo you get any warnings/error messages?
Any reason you've added an asterisk '*' after disabled property
Have you tried putting FQDN of the server PDB0V