WMIC commands
Local
Gather domain DC and other information
wmic NTDOMAIN Get DomainControllerAddress,DomainName,RolesList all Users
wmic /NAMESPACE:\\root\directory\ldap PATH ds_user GET ds_samaccountnameGet all groups
wmic /NAMESPACE:\\root\directory\ldap PATH ds_group GET ds_samaccountnameGet members of the domain admin group
wmic path win32_groupuser where (groupcomponent="win32_group.name='domain admins',domain="DOMAIN'")list all computers
wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_samaccountnameComputer information
wmic computersystem list full Available volumes
wmic volume list brief find AV
wmic /namespace:\\root\securitycenter2 path antivirusproduct GET displayName,  productState, pathToSignedProductExefind updates
wmic qfe list brieffind files with password in the name
wmic DATAFILE where "drive='C:' AND Name like '%password%'" GET Name,readable,size /VALUEget local use raccounts
wmic useraccount listWMI classes or information can also be accessed via Get-WmiObject in PowerShell. Some useful queries:
AV products
Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProductVM detection
[Bool](Get-WmiObject -Class Win32_ComputerSystem -Filter "NumberOfLogicalProcessors < 2 OR TotalPhysicalMemory < 2147483648")find MSI not from MS
Get-WmiObject -Query "select * from Win32_Product" | ?{$_.Vendor - notmatch 'Microsoft’}Logged on users
Get-WmiObject -Query "select * from Win32_LoggedOnUser" |  ?{$_.LogonType -notmatch '(Service|Network|System)’}VMWARE detection
$VMAdapter=Get-WmiObject Win32_NetworkAdapter -Filter 
'Manufacturer LIKE "%VMware%" OR Name LIKE "%VMware%"' 
$VMBios=Get-WmiObject Win32_BIOS -Filter 'SerialNumber LIKE 
"%VMware%"'
$VMToolsRunning=Get-WmiObject Win32_Process -Filter 
'Name="vmtoolsd.exe"'
[Bool]($VMAdapter -or $VMBios -or $VMToolsRunning)Gather domain DC and informationAD
We can enumerate remotely by adding /NODE:"<SERVER_NAME>"  enumerating under other user context can be done adding /USER:"<DOMAIN>\<USER>" /PASSWORD:"<password>" ex:
wmic /NODE:"DOMAIN" /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get *enumerate groups:
Get-CimInstance –ClassName Win32_Group -Filter "DOMAIN = '<DOMAIN>'"user accounts
Get-WMIObject –Class Win32_UserAccount -Filter "DOMAIN = '<DOMAIN>'"Group user memberships
Get-CimInstance -ClassName Win32_Group -Filter "Domain = <DOMAIN>' AND Name='<GROUP_NAME>'"Domain info
wmic NTDOMAIN GET DomainControllerAddress,DomainName,Roles /VALUELDAP
wmic /NAMESPACE:\\root\directory\ldap PATH ds_user GET ds_samaccountname
wmic /NAMESPACE:\\root\directory\ldap PATH ds_group GET ds_samaccountname
wmic /NAMESPACE:\\root\directory\ldap PATH ds_group where "ds_samaccountname='Domain Admins'" Get ds_member /Value
wmic /NAMESPACE:\\root\directory\ldap PATH ds_group where "ds_samaccountname='<GROUP_NAME>'" Get ds_member /Value
wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_dnshostnameLast updated
Was this helpful?
