Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use WMIC to query local administrator group members

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.

like image 422
erstbe Avatar asked Sep 30 '22 09:09

erstbe


1 Answers

This is what worked for me:

wmic /Node:"ComputerName" path win32_groupuser where (groupcomponent="win32_group.name=\"administrators\",domain=\"Computername\"")
like image 176
user5614017 Avatar answered Nov 05 '22 08:11

user5614017