SCOM 2016 System Center Internal Discovery MP Fix

Note: This is not tested with the new hotfix MP released for SCOM 2016 found here:https://blogs.technet.microsoft.com/momteam/2017/08/30/inbox-mp-hotfix-for-wmi-health-monitor/If you add the hotfix MP i recommend to also delete this one. This is a temporary fix for rules and mon

 
 
 
 
 
(0)
224 times
Add to favorites
System Center
12/24/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • function NetBIOSDomain
    5 Posts | Last post December 24, 2017
    • Hi Lerun,
      
      This MP works great, however there is an issue with how the NetbiosDomainName property is populated. The WMI query "Select DomainName from Win32_NTDomain" returns multiple objects when in a multi-domain forest. This means that the NetbiosDomainName property contains each domain in the forest separated by spaces rather than the domain a given computer is part of.
      
      I modified the NetBIOSDomain function within the discovery script to address this issue.
      
      #-----------------------------------------------------------
      # Returns the NetBIOS domain name
      #-----------------------------------------------------------
      function NetBIOSDomain
      {
          $query = "select domain from win32_computersystem"
      
          try
          {
              $ntDomain = (Get-CimInstance -Namespace "root\cimv2" -Query $query -ErrorAction Stop).Domain
          }
          catch
          {
              try
              {
                  $wmiObjects = Get-WmiObject -Namespace "root\cimv2" -Query $query -ErrorAction Stop
      
                  If($wmiObjects -is [System.Array]) 
                  {
                      ForEach($wmiObject in $wmiObjects)
                      {
                          if($wmiObject.DomainName -ne $Null)
                          {
                              $ntDomain = $wmiObject.Domain
                          }
                      }
                  }
                  else
                  {
                      $ntDomain = $ntDomain | Select-Object -ExpandProperty DomainName
                  }
                    
              }
              catch 
              {
                  LogEvent -EventNr $EventId -EventType $EVENT_ERROR -LogMessage "Error retrieving netbios domain name info.`n$($_.Exception.Message)`n$($_.InvocationInfo.PositionMessage)"
              }
              
          }
          return $ntDomain
      }
      
    • Oops.. This is better. :)
      
      #-----------------------------------------------------------
      # Returns the NetBIOS domain name
      #-----------------------------------------------------------
      function NetBIOSDomain
      {
          $query = "select domain from win32_computersystem"
      
          try
          {
              $ntDomain = (Get-CimInstance -Namespace "root\cimv2" -Query $query -ErrorAction Stop).domain
      	
          }
      
      	catch 
      	{
      		LogEvent -EventNr $EventId -EventType $EVENT_ERROR -LogMessage "Error retrieving netbios domain name info.`n$($_.Exception.Message)`n$($_.InvocationInfo.PositionMessage)"
      	}
              
          
          return $ntDomain
      }
    • Hi Noah, I kind of abandoned this as MS seems to have fixed some of the issues (but not all).
      I have also as the frontpage states had the opportunity to test if there are any conflicts using my fixes with the newest patches for MS. Having said that, I have changed the MP to use win32_computersystem instead and uploaded it.
      
      You can also see what MS has done in the newest fix here:
      http://systemcenter.wiki/?GetElement=Microsoft.SystemCenter.WindowsComputerPropertyDiscovery&Type=DataSourceModuleType&ManagementPack=Microsoft.SystemCenter.Internal&Version=7.0.8437.10
      
      Happy holidays!
    • I guess you mean the other MP, this does not use Netbios function. See there for my comments.
    • Brain fart, hate that one cannot delete comments made in error.
  • SQL Cluster Discover Broken
    4 Posts | Last post September 05, 2017
    • Hi Lerun,
      Just a note to say that after importing this MP everything seemed fine, however when pushing the agent to new SQL clusters the SQL discoveries were failing.
      The really bad news for troubleshooting is they were failing almost silently. If I watched the console carefully I'd see the Engine appear and the Databases start to populate, then suddenly they would all disappear.
      No events were logged on the agent saying the discovery scripts were failing and on the management server you'd see a few instances of event ID 10801 and 33333
      
      
    • -First Event-
      Data Access Layer rejected retry on SqlError:
       Request: p_DiscoverySourceUpsert -- (DiscoverySourceId=6268c2b6-eee9-00d4-2db9-9a0b6cabac9b), (DiscoverySourceType=0), (DiscoverySourceObjectId=8116d365-41a9-0d0a-fd9b-8478a5fe9976), (IsSnapshot=True), (TimeGenerated=30/08/2017 13:02:30), (BoundManagedEntityId=8c2dcf2f-9615-ea5f-6b3a-e6fe12be1922), (IsDiscoveryPackageStale=), (RETURN_VALUE=1)
       Class: 16
       Number: 777980004
       Message: Discovery data has been received from a rule targeted to a non-existent entity. The discovery data will be dropped.
      
      -Second event-
      Data Access Layer rejected retry on SqlError:
       Request: p_DiscoverySourceUpsert -- (DiscoverySourceId=6268c2b6-eee9-00d4-2db9-9a0b6cabac9b), (DiscoverySourceType=0), (DiscoverySourceObjectId=8116d365-41a9-0d0a-fd9b-8478a5fe9976), (IsSnapshot=True), (TimeGenerated=30/08/2017 13:02:30), (BoundManagedEntityId=8c2dcf2f-9615-ea5f-6b3a-e6fe12be1922), (IsDiscoveryPackageStale=), (RETURN_VALUE=1)
       Class: 16
       Number: 777980004
       Message: Discovery data has been received from a rule targeted to a non-existent entity. The discovery data will be dropped.
      
      -Third Event-
      Discovery data couldn't be inserted to the database. This could have happened because  of one of the following reasons:
      
       	- Discovery data is stale. The discovery data is generated by an MP recently deleted.
       	- Database connectivity problems or database running out of space.
       	- Discovery data received is not valid.
      
       The following details should help to further diagnose:
      
       DiscoveryId: 8116d365-41a9-0d0a-fd9b-8478a5fe9976
       HealthServiceId: 1707a224-0f50-4721-2e3a-029324adb2cb
       Microsoft.EnterpriseManagement.Common.DiscoveryDataFromRuleTargetedToDeletedObjectException,Discovery data has been received from a rule targeted at a non-existent object ID.
      Object ID: 8c2dcf2f-9615-ea5f-6b3a-e6fe12be1922
      Rule ID: 8116d365-41a9-0d0a-fd9b-8478a5fe9976.
    • Seems strange. This MP does not use any of the classes associated with the SQL MP
      
      Have you tried to find the name of the discovery?
      On a mgmt server you can run the following powershell commands to find out the name of the rule:
      
      Import-Module operationsmanager
      Get-SCOMRule -Id "8116d365-41a9-0d0a-fd9b-8478a5fe9976"
      
      Seems like the rule is trying to put data into an object that is no longer present for some reason. 
      
    • Also if you have imported the new hotfix MP(https://blogs.technet.microsoft.com/momteam/2017/08/30/inbox-mp-hotfix-for-wmi-health-monitor/), it might conflict with this one. I have not looked into what they have changed in the hotfix MP.
      
      
  • Installation Query
    2 Posts | Last post July 22, 2017
    • Firstly thanks for providing this.
      
      Secondly I take it all I need to do is to import this MP into my 2016 estate and do nothing else?
      
      Kind Regards.
    • You are welcome
      
      Yes, this MP will disable the built discoveries and go active.