25 nov 2014

Consultas WMI



Genérica
Set objWMIService = GetObject("winmgmts:\\" & host & "\root\cimv2")
Registro
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & host & "\root\default:StdRegProv")
Políticas
Set objRsop=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & host & "\root\rsop\computer")

Usuarios locales: "Select * from Win32_UserAccount Where LocalAccount = True"
Grupos locales: "Select * from Win32_Group  Where LocalAccount = True"
Usuarios dentro de un grupo: SELECT * FROM Win32_GroupUser WHERE (groupcomponent = 'win32_group.name="Administrators",domain="MyHostName"')
Informacion de un User Profile: "Select * From Win32_UserProfile"
Servicios: "Select * from Win32_Service"
Shares: "Select * from Win32_Share"

Politicas

"select * from RSOP_SecuritySettingNumeric where precedence=1"
"Select * from RSOP_UserPrivilegeRight where precedence=1"
"Select * from RSOP_PolicySetting where precedence=1"
"Select * from RSOP_AuditPolicy where precedence=1"