WMI in ConfigMgr

Report
WMI For the System
Center Configuration
manager 2007
Administrator
System Center
User Group Belgium
Agenda









Introduction
WMI basics
Troubleshoot WMI
Extended WQL (WMI query language)
WMI Tools
WMI in ConfigMgr
Advanced WMI in ConfigMgr
SccmAutoDoc
Q&A
Introduction

What is WMI?
◦ Wikipedia: “WMI is Microsoft's implementation
of the Web-Based Enterprise Management
(WBEM) and Common Information Model (CIM)
standards from the Distributed Management
Task Force (DMTF).
◦ SMS 2.0 MOC: “WMI does for management
software what printer drivers did for printing”
◦ Me: “ The registry on steroids.”
WMI basics (1)
Namespaces
 Classes
 Methods
 Properties

◦ Embedded properties
 Props
 Proplists
 regmultistringlists
◦ Lazy properties
WMI basics (2)

Providers
◦
◦
◦
◦
◦
◦

regProv
regPropProv
Disk & CPU
View instance provider
AI Providers (aainstprov)
Write your own
(http://myitforum.com/cs2/blogs/rzander/archive/2009/03/30/wm
i-provider-to-list-the-monitors-serialnr-and-model-name.aspx)
Events
◦ SELECT * FROM __InstanceModificationEvent WITHIN 10 WHERE
TargetInstance ISA 'SMS_Collection'

Qualifiers
◦ Dynamic
◦ CimType
Troubleshoot WMI


Wmidiag
Repair
◦ XP SP2+
 rundll32 wbemupgd, UpgradeRepository
◦ Vista and above (Needs to be Run as administrator)
 winmgmt /salvagerepository
◦ Windows server 2003
 rundll32 wbemupgd, RepairWMISetup

Re-register wmi components
◦ cd /d %windir%\system32\wbem
◦ for %i in (*.dll) do RegSvr32 -s %i
◦ for %i in (*.exe) do %i /RegServer

Rebuild repository as a last resort (Might kill other applications)
◦ Net stop winmgmt
◦ Ren %windir%\System32\Wbem\Repository
%windir%\System32\Wbem\Repository_Bad
◦ Net start winmgmt
Extended WQL

Extended Wql (http://msdn.microsoft.com/en-us/library/cc146121.aspx)
◦ Select x from class
◦ Other keywords
 Distinct, count, join, where, order by
 In / not in
 GetDate, datediff, dateadd
http://www.myitforum.com/articles/8/view.asp?id=10909
SELECT DISTINCT SMS_MonthlyUsageSummary.ResourceID
FROM
SMS_MonthlyUsageSummary
INNER JOIN
SMS_MeteredFiles
ON
SMS_MonthlyUsageSummary.FileID = SMS_MeteredFile.MeteredFileID
WHERE
DateDiff(day,SMS_MonthlyUsageSummary.LastUsage, GetDate()) < 90
AND SMS_MeteredFiles.RuleID = 6
WMI Tools
Wbemtest
 Cim studio
 Wmic

◦ http://scug.be/blogs/sccm/archive/2009/09/15/adding-wmic-right-click-actionsto-the-configmgr-2007-admin-console-1.aspx
Policyspy
 Script
 SDK

◦ http://www.microsoft.com/downloads/details.aspx?FamilyId=064A995F-EF134200-81AD-E3AF6218EDCC&displaylang=en
WMI in ConfigMgr (1)

Omni-Present
◦
◦
◦
◦
◦
SMS Provider / Administrator console
Dynamic Collections
Queries
Hardware inventory
ConfigMgr client settings store
WMI in ConfigMgr (2)

Namespaces used by Sccm
◦ Server side
 Root\sms (sms_providerlocation)
 Root\sms\site_sitecode
◦ Client side
 Root\ccm
 Root\ccm\invagt
 Root\ccm\policy

Sccm wmi Class structure
◦ Abstract classes (Require sitecode='xyz')
 Sms_sci
 Sms_siib
◦ Sms_r*
◦ Sms_g*
◦ Sms_cm_res_coll_collid
Advanced WMI in
Configuratio Manager

Local Policies
◦ http://technet.microsoft.com/enus/magazine/2006.09.customizesms.aspx
◦ Examples
 Request permission for Remote Tools
 Custom Hardware Inventory
 Disable individual agents
[CCM_Policy_PartialPolicy(true)]
instance of CCM_SoftwareDistributionClientConfig
{SiteSettingsKey = 1;
PolicySource = "Local";
// override only this property, all others from the
Site/Management Point
[CCM_Policy_Override(true)]
Enabled = FALSE;};
SccmAutoDoc

What is SccmAutodoc?
1. My source for getting to know WMI in ConfigMgr
2. A program that, based on WMI queries
automatically documents your site settings
Where can I get SccmAutodoc?

◦
SccmAutodoc 1.126 is currently in beta and can
be downloaded from http://www.scug.be/media
Is SccmAutodoc freeware?

◦
SccmAutodoc will become moderately priced
software once it leaves the beta stages, hopefully
somewhere near the end of this year.
Q&A
Thank You
SCUG.be !

similar documents