Use WMIC to query local administrator group members

command, windows, wmi, wmic

Solution

This is what worked for me:

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

Problem

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.

Original source