How To get Local Administrator Group Users On Sccm

1-Sccm > Administration > Client Settings > Default Client Settings
2. Export to  Hardware Inventory >Set Classes> Export .Mof file

3.Edit the .mof file write bottom:


[ SMS_Report (TRUE),
  SMS_Group_Name ("LocalAdmins"),
  SMS_Class_ID ("MICROSOFT|LocalAdmins|1.0"),
  Namespace ("root\\\\cimv2") ]
class Win32_LocalAdmins : SMS_Class_Template
    [SMS_Report (TRUE), key ] string Account;
    [SMS_Report (TRUE)      ] string Domain;
    [SMS_Report (TRUE), key ] string Name;
    [SMS_Report (TRUE)      ] string Type; 

4. Click  to all local admins report from Hardware inventory.

5. Publishing this script all your client.

On Error Resume Next
'1 Create temporary .mof file in Temp folder
'2 mofcomp the created .mof file
'Best Regards-->
'and of course Ward Lange, and report structure from Kerim Cantürk-->
'5/3/18 Kerim Cantürk
Set fso = CreateObject("Scripting.FileSystemObject") 
Set nwo = CreateObject("Wscript.Network") 
Set sho = CreateObject("Wscript.Shell") 
TempFolder = sho.ExpandEnvironmentStrings("%temp%")
strWindir = sho.ExpandEnvironmentStrings("%windir%")
Set f1 = fso.CreateTextFile(TempFolder & "\SMSLocalAdmin.mof",True)
f1.WriteLine("#pragma namespace ("&Chr(34)&"\\\\.\\root\\cimv2"&chr(34)&")")
f1.WriteLine("[union, ViewSources{"&chr(34)&"Select * from Win32_GroupUser where " &_
    "},ViewSpaces{"&Chr(34)&"\\\\.\\root\\CIMV2"&Chr(34)&"}, Dynamic : ToInstance, provider("&_
f1.WriteLine("class Win32_LocalAdmins")
f1.WriteLine("[PropertySources("&chr(34)&"PartComponent"&chr(34)&"), key] Win32_Account ref AccountName;")
f1.WriteLine("[PropertySources("&chr(34)&"GroupComponent"&chr(34)&"), key] Win32_Group ref GroupName;")
sho.Run strWindir & "\system32\wbem\mofcomp " & TempFolder & "\SMSLocalAdmin.mof",0,True
Set f1 = fso.getFile(TempFolder & "\smslocaladmin.mof")

6. And get report with Manual Sql Querry

For Example:

select * from v_GS_LocalAdmins


select distinct Name0 as 'Computer Name', substring(AccountName0,charindex('Domain=',Accountname0)+8,(charindex('Name=',Accountname0)-charindex('Domain=',Accountname0)-10)) as 'Domain Name', substring(AccountName0,len(AccountName0)-charindex('"',reverse(AccountName0),2)+2,charindex('"',reverse(AccountName0),2)-2) as 'User Name'  from v_GS_SYSTEM INNER JOIN v_GS_LocalAdmins ON v_GS_SYSTEM.ResourceID = v_GS_LocalAdmins.ResourceID where (AccountName0 not like '%Administrator%' AND AccountName0 not like '%Domain Admins%')

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir