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}