5

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.

ekad
  • 14,436
  • 26
  • 44
  • 46
erstbe
  • 83
  • 1
  • 1
  • 7

2 Answers2

3

This is what worked for me:

wmic /Node:"ComputerName" path win32_groupuser where (groupcomponent="win32_group.name=\"administrators\",domain=\"Computername\"")
Chris Loonam
  • 5,735
  • 6
  • 41
  • 63
2

It is not going to work, you need to add the % on the ComputerName as its a variable

It should look like this

wmic /Node:"%ComputerName%" path win32_groupuser where (groupcomponent="win32_group.name=\"administrators\",domain=\"%ComputerName%\"")
zmag
  • 7,825
  • 12
  • 32
  • 42
JoeNZ
  • 21
  • 1