次の方法で共有


SCOM: Windows Server Logical Disk Volume Name Added!

As you may be aware, the Windows server logical disks and mount points discoveries do not populate the Volume Name property. I have no idea why the product group left the label out of the original discovery script or why it hasn't been added in any subsequent updates. It was easy enough to add back in. I disabled the original discoveries and created slightly modified ones that include the Volume Name property.

windowsdiskhelper_inventory1

 

This MP contains:

Overrides which disable the following discoveries:

  • MWS2003D!Microsoft.Windows.Server.2003.LogicalDisk.Discovery
  • MWS2008D!Microsoft.Windows.Server.2008.LogicalDisk.Discovery
  • MWS2008D!Microsoft.Windows.Server.2008.MountPoint.Discovery
  • MWS2012D!Microsoft.Windows.Server.6.2.LogicalDisk.Discovery

MWS2003D!Microsoft.Windows.Server.2003.MountPoint.Discovery (Already disabled by default)
MWS2012D!Microsoft.Windows.Server.6.2.MountPoint.Discovery (Already disabled by default)

 

New discoveries (all enabled by default) with slightly modified datasources:

  • WindowsDiskHelper.Server.LogicalDisk.NoMonitor.Group.Discovery (group to contain any disks with "NoMonitor" in the name)
  • WindowsDiskHelper.Microsoft.Windows.Server.6.2.LogicalDisk.Discovery
  • WindowsDiskHelper.Microsoft.Windows.Server.6.2.MountPoint.Discovery
  • WindowsDiskHelper.Microsoft.Windows.Server.2008.LogicalDisk.Discovery
  • WindowsDiskHelper.Microsoft.Windows.Server.2008.MountPoint.Discovery
  • WindowsDiskHelper.Microsoft.Windows.Server.2003.MountPoint.Discovery
  • WindowsDiskHelper.Microsoft.Windows.Server.2003.LogicalDisk.Discovery

 

windowsdiskhelper_discoveries1

Example code snippet from the Server 2012 Mount Point Discovery datasource:

Added code is in pink .

  1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233343536
 Function DoDiscovery(ByVal sTargetComputer, ByVal sTargetComputerID, ByVal oDisc, ByVal sMPElementID)    Dim objMountPoints, objMountPnt, oInstance, strDeviceID, sLabel    Dim objVolumes, objVol    Set objMountPoints = WMIGetInstance("winmgmts:\\" + sTargetComputer + "\root\cimv2", "Win32_MountPoint")    For Each objMountPnt In objMountPoints        Set oInstance = oDisc.CreateClassInstance(sMPElementID)        strDeviceID = FixVolumeName(objMountPnt.Volume)        Set objVolumes = WMIGetInstance("winmgmts:\\" + sTargetComputer + "\root\cimv2", "Win32_Volume where DriveType = 3 and driveletter = null and DeviceID ='" & strDeviceID & "'")        For Each objVol In objVolumes            With oInstance              .AddProperty "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sTargetComputerID              .AddProperty "$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", StripEndChar(GetWMIProperty(objVol, "Name", wbemCimtypeUseDefault, ErrAction_None))              .AddProperty "$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/Name$", StripEndChar(GetWMIProperty(objVol, "Name", wbemCimtypeUseDefault, ErrAction_None))              .AddProperty "$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/Description$", "Mounted Disk" ' "Description" property of win32_volume is <null>              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/FileSystem$", GetWMIProperty(objVol, "FileSystem", wbemCimtypeUseDefault, ErrAction_None)              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/Compressed$", GetWMIProperty(objVol, "Compressed", wbemCimtypeUseDefault, ErrAction_None)              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/Size$", GetWMIProperty(objVol, "Capacity", wbemCimtypeUseDefault, ErrAction_None)              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/SizeNumeric$", -1              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/SizeInMBs$", ExpressedInMB(GetWMIProperty(objVol, "Capacity", wbemCimtypeUseDefault, ErrAction_None))              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/DriveType$", GetWMIProperty(objVol, "DriveType", wbemCimtypeUseDefault, ErrAction_None)              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/SupportsDiskQuota$", GetWMIProperty(objVol, "SupportsDiskQuotas", wbemCimtypeUseDefault, ErrAction_None)              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/QuotasDisabled$", SwitchBoolean(GetWMIProperty(objVol, "QuotasEnabled", wbemCimtypeUseDefault, ErrAction_None))              .AddProperty "$MPElement[Name='WindowsServer!Microsoft.Windows.Server.LogicalDisk']/SupportsFileBasedCompression$", GetWMIProperty(objVol, "SupportsFileBasedCompression", wbemCimtypeUseDefault, ErrAction_None)              ' This is where we add the VolumeName property              sLabel = GetWMIProperty(objVol, "Label", wbemCimtypeUseDefault, ErrAction_None)              If Not IsNull(sLabel) Then .AddProperty "$MPElement[Name='Windows!Microsoft.Windows.LogicalDisk']/VolumeName$", sLabel                    End With                    Call oDisc.AddInstance(oInstance)        Next    Next    DoDiscovery = 0End Function

 

DOWNLOAD HERE

Comments

  • Anonymous
    September 22, 2016
    This MP works great ! The rediscoveries happened quickly, little load on the OP DB, and occurred without issue. Thanks !