- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the locked local user accounts using PowerShell?
To get the locked user accounts on the local or the remote machines using PowerShell, we can use the wmi method.
PS C:\> gwmi win32_useraccount | where{$_.Lockout -eq $true}
You can also use the CIM instance method alternatively.
PS C:\> Get-CimInstance Win32_Useraccount | where{$_.Lockout -eq $true}
To get the locked local user accounts on the remote computer, you can use the -ComputerName parameter in the WMI class or the CIM instance. For example,
PS C:\> gwmi win32_useraccount -ComputerName TestMachine1, TestMachine2 | where{$_.Lockout -eq $true}
Advertisements