This code pulls the name of the local administrator account using wmi. I was hoping I can do something similar using relevance.
Is there an equivalent BigFix relevance statement to access this via wmi?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
("Select * From Win32_UserAccount Where LocalAccount = TRUE")
For Each objAccount in colAccounts
If Left (objAccount.SID, 6) = "S-1-5-" and Right(objAccount.SID, 4) = "-500" Then
Wscript.Echo objAccount.Name
End If
Next
Yes, and you don’t need to use WMI. In fact, performance is nearly 10 times better if you don’t use WMI
Q: (names of it) of local users whose ((it starts with “S-1-5-” and it ends with “-500”) of component strings of sids of it)
A: Administrator
T: 13.567 ms
I: plural string
Q: string values of properties “Name” of select objects (" * From Win32_UserAccount where LocalAccount = TRUE AND SID LIKE ‘S-1-5-%25’ AND SID LIKE ‘%25-500’") of wmi