Use WMIC to query local administrator group members

erstbe picture erstbe · Jul 7, 2014 · Viewed 16.7k times · Source

Does anyone know of a way to query members of the local admin group using WMIC (On a remote server)? I'm aware that this is possible through powershell and vbs, but I'm really looking for a command line only option (to be called from an internal PHP site).

I've tried the following

wmic /Node:"ComputerName" path win32_groupuser where (groupcomponent="win32_group.name=\"administrators\",domain=\"Domain\"")

but wasn't able to get it to work.

Answer

user5614017 picture user5614017 · Nov 28, 2015

This is what worked for me:

wmic /Node:"ComputerName" path win32_groupuser where (groupcomponent="win32_group.name=\"administrators\",domain=\"Computername\"")