Display if a local user is enabled or disabled
I'm trying to create a custom inventory rule to display the local users and their enabled status and then display this information in a report. I'm currently using WMIC but with it being discontinued this year I'm trying to find an equivalent in either Powershell or CMD and I have the need to display if the account is enabled or not.
I'm currently using ShellCommandTextReturn(cmd.exe /c wmic useraccount where "localaccount=true" get name)
I'm trying to create this script with powershell since it displays all the information I need but it's not showing any information in KACE. It works fine in Powershell. ShellCommandTextReturn(powershell.exe get-LocalUser)
Answers (3)
Top Answer
Hello jrodlivewire06,
Can you please try:
ShellCommandTextReturn(cmd /q /c cmd /q /c %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe (get-LocalUser))
I have tried that one in my lab and it works. I used this KB from Quest support as a reference:
https://support.quest.com/kace-systems-management-appliance/kb/4299395/cir-and-report-to-verify-patching-enhancement-bundle
Best regards,
Mauricio.