Freigeben über


Configuration Manager WMI-Namespaces und -Klassen für Configuration Manager Berichte

Wenn Configuration Manager installiert ist, werden mehrere WMI-Namespaces (Windows Management Instrumentation) erstellt, und je nach Namespace können unter jedem Namespace Hunderte von Klassen erstellt werden. Außerdem verfügt jeder Standort möglicherweise über Klassen, die andere Websites abhängig von den spezifischen Standorteinstellungen, dem nachverfolgten Bestand usw. möglicherweise nicht haben.

Von Configuration Manager erstellte WMI-Namespaces

Die folgenden WMI-Namespaces werden von Configuration Manager erstellt:

  • root\ccm
    • root\ccm\CCMPasswordSettings
    • root\ccm\CIModels
    • root\ccm\CIStateStore
    • root\ccm\CIStore
    • root\ccm\CITasks
    • root\ccm\ClientSDK
    • root\ccm\ContentTransferManager
    • root\ccm\DataTransferService
    • root\ccm\dcm
    • root\ccm\DCMAgent
    • root\ccm\evaltest
    • root\ccm\Events
    • root\ccm\InvAgt
    • root\ccm\LocationServices
    • root\ccm\Messaging
    • root\ccm\NetworkConfig
    • root\ccm\PeerDPAgent
    • root\ccm\Policy
    • root\ccm\PowerManagementAgent
    • root\ccm\RebootManagement
    • root\ccm\ScanAgent
    • root\ccm\Scheduler
    • root\ccm\SMSNapAgent
    • root\ccm\SoftMgmtAgent
    • root\ccm\SoftwareMeteringAgent
    • root\ccm\SoftwareUpdates
    • root\ccm\StateMsg
    • root\ccm\VulnerabilityAssessment
    • root\ccm\XmlStore
    • root\cimv2\sms
    • root\smsdm
    • root\sms
    • root\sms\site_<site code>

Abrufen Configuration Manager WMI-Namespaces und -Klassen mithilfe eines Visual Basic-Skripts

Eine einfache Möglichkeit zum Auflisten der Configuration Manager zugehörigen Klassen, die auf Ihrer Website erstellt wurden, ist die Ausführung eines Microsoft Visual Basic-Skripts. Das folgende Skript überprüft alle Klassen in jedem der oben aufgeführten WMI-Namespaces und gibt die Ergebnisse in einer Textdatei aus.

So führen Sie das Skript aus, um die WMI-Namespaces und -Klassen zu überprüfen

  1. Kopieren Sie den folgenden Code in Editor:

        '======================================================================================= 
        ' 
        ' NAME: WMIScan.vbs 
        ' 
        ' AUTHOR:  Microsoft Corporation 
        ' DATE  : 10/24/2013 (Revised for System Center 2012 Configuration Manager by Rob Stack) 
        ' 
        ' COMMENT: Script to scan Configuration Manager WMI classes. 
        ' 
        '======================================================================================= 
    
        Dim SearchChar 
        Dim TotChar 
        Dim RightChar 
        Dim ClassName 
        Dim Computer 
        Dim strComputer 
        Dim strUser 
        Dim strPassword 
        Dim strSiteCode 
        Dim strNameSpace 
        Dim strFolder 
        Dim strFile 
        Dim strLogFile 
        Dim strFullFile 
        Dim strFullLogFile 
        Dim isError 
    
        Const ForWriting = 2 
        Const ForAppending = 8 
        Const adOpenStatic = 3 
        Const adLockOptimistic = 3 
        Const adUseClient = 3 
    
        set colNamedArguments=wscript.Arguments.Named 
        If colNamedArguments.Exists("Sitecode") Then 
          strSiteCode = colNamedArguments.Item("Sitecode") 
        Else 
          WScript.Echo "Invalid Command Line Arguments" & vbCrLf & _ 
            vbCrLf & "Usage: WMIScan.vbs /Sitecode:<sitecode> " & _ 
            "/Computer:<computername>" & vbCrLf & vbCrLf & _ 
            "Example1: WMIScan.vbs /Sitecode:PS1" & vbCrLf & _ 
            "Example2: WMIScan.vbs /Sitecode:PS1 /Computer:Computer1" 
          WScript.Quit(1) 
        End If 
        If colNamedArguments.Exists("Computer") Then 
          strComputer = colNamedArguments.Item("Computer") 
        Else strComputer = "." 
        End If 
    
        'Define the values for files and folders. 
        strFolder = "c:\WMIScan" 
        strFile = "WMIScan.txt" 
        strLogFile = "WMIScan.log" 
        strFullFile = strFolder & "\" & strFile 
        strFullLogFile = strFolder & "\" & strLogFile 
        isError = 0 
    
        'List of Configuration Manager namespaces are put into an array. 
        arrNameSpaces = Array("root\ccm","root\ccm\CCMPasswordSettings","root\ccm\CIModels",_
        "root\ccm\CIStateStore","root\ccm\CIStore","root\ccm\CITasks",_
        "root\ccm\ClientSDK","root\ccm\ContentTransferManager","root\ccm\DataTransferService",_
        "root\ccm\dcm","root\ccm\DCMAgent","root\ccm\evaltest",_
        "root\ccm\Events","root\ccm\InvAgt","root\ccm\LocationServices",_
        "root\ccm\Messaging","root\ccm\NetworkConfig","root\ccm\PeerDPAgent",_
        "root\ccm\Policy","root\ccm\PowerManagementAgent","root\ccm\RebootManagement",_
        "root\ccm\ScanAgent","root\ccm\Scheduler","root\ccm\SMSNapAgent",_
        "root\ccm\SoftMgmtAgent","root\ccm\SoftwareMeteringAgent","root\ccm\SoftwareUpdates",_
        "root\ccm\StateMsg","root\ccm\VulnerabilityAssessment","root\ccm\XmlStore",_
        "root\cimv2\sms","root\smsdm","root\sms",_
        "root\sms\site_"& strSiteCode)
    
        'Creates the folder and files for the scan output and log file. 
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
    
        'Does strFolder Folder exist? If not, it's created. 
        If Not objFSO.FolderExists(strFolder) then 
          Set objFolder = objFSO.CreateFolder(strFolder) 
        End If 
    
        'Creates the WMIScan.txt and WMIScan.log files. 
        Set objFile = objFSO.CreateTextFile(strFullFile) 
        Set objLogFile = objFSO.CreateTextFile(strFullLogFile) 
        objFile.close 
        objLogFile.close 
    
        'Opens the WMIScan.log file in write mode. 
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        Set objLogFile = objFSO.OpenTextFile(strFullLogFile, ForWriting) 
        objLogFile.WriteLine "********************************************" 
        objLogFile.WriteLine " WMIScan Tool Executed - " & Now() 
        objLogFile.WriteLine "********************************************" 
    
        'Opens the WMIScan.txt file in write mode. 
        Set objFile = objFSO.OpenTextFile(strFullFile, ForWriting) 
        objLogFile.WriteLine "--------------------------------------------" 
        Computer = strComputer 
        If Computer = "." Then Computer = "Local System" 
        objLogFile.WriteLine " Scanning WMI Namespaces On " & Computer 
        objLogFile.WriteLine "--------------------------------------------" 
    
        WScript.echo "Starting WMI scan on " & Computer 
    
        'Create a collection of Namespaces from the array, and 
        ' call the EnumNameSpaces subroutine to do the scan. 
        For Each strNameSpace In arrNameSpaces 
           Call EnumNameSpaces(strNameSpace, strComputer) 
        Next 
        objLogFile.WriteLine "---------------------------------------------" 
        objLogFile.WriteLine " Done scanning WMI Namespaces on " & Computer 
        objLogFile.WriteLine "---------------------------------------------" 
    
        'Close the WMISscan.txt file. 
        objFile.close 
    
        If isError = 1 Then 
          WScript.Echo "WMI Scan has Completed with Errors!" & vbCrLf & _ 
          "Check the " & strLogFile & " file for more details." & vbCrLf & _ 
          vbCrLf & strFile & " & " & strLogFile & " have been written to "_ 
          & strFolder & "." 
        Else 
          WScript.Echo "WMI Scan has Completed without any Errors!" & _ 
          vbCrLf & vbCrLf & strFile & " & " & strLogFile & _ 
          " have been written to " & strFolder & "." 
        End If   
    
        '*************************************************************** 
        '***   Subroutine to do the classes scan on the namespace.   *** 
        '*************************************************************** 
        Sub EnumNameSpaces(strNameSpace, strComputer) 
          Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") 
          On Error Resume next 
          Set objSWbemServices= objSWbemLocator.ConnectServer (strComputer,_ 
            strNameSpace) 
          objLogFile.Write "Connecting to the \\" & strComputer & "\" &_ 
            strNameSpace & " WMI NameSpace...." 
          If Err.number = 0 Then  
            objLogFile.WriteLine "Success!!" 
            objLogFile.Write "  Scanning for Classes in "&strNameSpace _ 
              & "..." 
    
            'Create a collection of all the subclasses of the namespace. 
            Set colClasses = objSWbemServices.SubclassesOf() 
    
            'Scan all WMI classes, and write them to the scan1.txt file. 
            objFile.WriteBlanklines(1) 
            objFile.WriteLine "\\" & strComputer & "\" & strNameSpace 
    
            For Each objClass In colClasses 
              SearchChar = instr(objClass.Path_.Path, ":") 
              TotChar = len(objClass.Path_.Path) 
              RightChar = TotChar - SearchChar 
              ClassName = right(objClass.Path_.Path,RightChar) 
              objFile.WriteLine "   " & ClassName 
            Next 
            objLogFile.WriteLine "Success!!" 
          ElseIf Err.Number = -2147024891 Then 
            objLogFile.WriteLine "Error " & Err.Number & _ 
              "! Connection to "& strComputer & " Failed!" 
            isError = 1 
          Elseif Err.Number = -2147217394 Then 
            objLogFile.WriteLine "Error " & Err.Number & "!! Namespace "&_ 
              strNameSpace & " NOT Found!!" 
            isError = 1   
          Else 
            objLogFile.WriteLine "Error " & Err.Number & "!!" 
          isError = 1 
          End If 
    
        End Sub
    
  2. Erstellen Sie einen Ordner mit dem Namen C:\WMIScan.

  3. Speichern Sie das Skript als WMIScan.vbs im Ordner C:\WMIScan.

  4. Öffnen Sie ein Eingabeaufforderungsfenster.

  5. Geben Sie C:\WMIScan\WMIScan.vbs /sitecode:ABC ein, und drücken Sie dann die EINGABETASTE. Stellen Sie sicher, dass Sie ABC durch den entsprechenden Standortcode ersetzen.

    Hinweis

    In der obigen Befehlszeile wird davon ausgegangen, dass das Skript von einem Configuration Manager Standortserver ausgeführt wird. Verwenden Sie zum Herstellen einer Verbindung mit WMI auf einem Remotestandortserver das Argument /computer:<computername> , um den Remotecomputer anzugeben. Wenn Sie beispielsweise eine Verbindung mit standortcode ABC auf Computer1 herstellen möchten, geben Sie in der Befehlszeile C:\WMIScan\WMIScan.vbs /sitecode:ABC /computer:Computer1 ein.

Das Skript erstellt eine Textdatei (in C:\WMIScan) mit allen WMI-Klassen in jedem der WMI-Namespaces für Configuration Manager, wenn es auf einem Configuration Manager primären Standortserver ausgeführt wird. Außerdem wird eine Protokolldatei erstellt, in der alle überprüften Namespaces aufgelistet sind und ob die Überprüfung erfolgreich war. Beachten Sie, dass einige Namespaces auf einigen Standortservern nicht vorhanden sind, je nachdem, welche Optionen konfiguriert wurden.

Siehe auch

WMI-Schemareferenz für SMS-Anbieter in Configuration Manager