Archive | SCOM RSS feed for this section

Failed VSAE build with message: Could not load management pack System.AdminItem.Library

4 Nov

Again a new addition to the VSAE build errors KB.

Problem

You compile a VSAE project and you get the compile error below:

Severity    Code    Description    Project    File    Line    Suppression State

Error        Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.

: Could not load management pack [ID=System.AdminItem.Library, KeyToken=31bf3856ad364e35, Version=7.5.8500.0]. The management pack was not found in the store.

An object of class ManagementPack with name System.AdminItem.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)    OpsLogix.IMP.VMWare.VirtualMachine.Monitoring    Monitoring\Monitors\OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage.mpx    4    

 

Investigation

 

Hue ? Could not load management pack System.AdminItem.Library ?

But I don’t use this one at all. So you could add this MP to the references and end up with a new error saying :

Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.: Could not load management pack [ID=System.Software.Library, KeyToken=31bf3856ad364e35, Version=7.5.8501.0]. The management pack was not found in the store.An object of class ManagementPack with name System.Software.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)

 

Again we add the missing MP : System.Software.Library

And now we get

Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.

: Could not load management pack [ID=Microsoft.SystemCenter.NTService.Library, KeyToken=31bf3856ad364e35, Version=7.0.9538.0]. The management pack was not found in the store.

An object of class ManagementPack with name Microsoft.SystemCenter.NTService.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)    OpsLogix.IMP.VMWare.VirtualMachine.Monitoring    Monitoring\Monitors\OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage.mpx

 

So again we could add the MP ref but I can tell you now already that this won’t help at all. The compiler is just trying to search through known types to see if it can map a property.

Just jump to the solution because it very simple….

Solution

 

Just double check if the class properties you refer are correctly spelled (case sensitive!) . In this case the names were not correct.

Also it could be that it couldn’t find the property at all. Same error is displayed.

 

Hope this helps.

Happy Scomming

Michel Kamp

Computer property Organizational Unit is Empty

30 Oct

 

The problem:

 

For a show case I had to make a group based on the computer OU. I ‘m using SCOM 2016 and had installed only the basic out of the box MPs.

I noticed that the Organizational Unit property was empty. Hmm why ? do I miss a MP doing this ??


 

The investigation:

 

So first I searched for a discovery filling this property. It is internal id is named : Microsoft.SystemCenter.DiscoverWindowsComputerProperties

See here : https://systemcenter.wiki/?GetElement=Microsoft.SystemCenter.DiscoverWindowsComputerProperties&Type=Discovery&ManagementPack=Microsoft.SystemCenter.Internal&Version=7.0.8443.6

Next I had a look at the datasource and took out the PS script part.

See here : https://systemcenter.wiki/?GetElement=Microsoft.SystemCenter.WindowsComputerPropertyDiscovery&Type=DataSourceModuleType&ManagementPack=Microsoft.SystemCenter.Internal&Version=7.0.8443.6

I opened a ISE on that server and copied the script into the editor.

Changed the initial params as :

#param($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)

 

$SourceType=0

$SourceId=
[guid]::newguid()

$ManagedEntityId
=
[guid]::newguid()

$ComputerIdentity=“SCOMADMIN11.contoso.com”

 

And executed the script. And I got a error indicating that the $computer was empty. Searched and i noticed that the $ADSISearcher.Filter  is incorrect so the computer object isn’t populated from LDAP.

 

it is  

$ADSISearcher.Filter = ‘(&(DNSHostName=’ + $strDNSComputerName + ‘)(Name=’ + $strNetBIOSComputerName + ‘)(objectClass=computer))’;

but should be 

$ADSISearcher.Filter = ‘(&(DNSHostName=’ + $strDNSComputerName + ‘)(Name=’ + $strNetBIOSComputerName + ‘)(objectClass=computer))’;
    

So it’s a bug 😉

Solution:

 

Till the responsible Microsoft team isn’t going to fix this you will have to make you own discovery workflow to fill this property.

Hope this helps

Happy SCOMMING.

VSAE malicious compiling challenges

25 Oct

Below a memory dump for myself.

The challenge

 

During compiling your management Pack in VSAE you get this nice blurry error message:

Detected malicious verification code when verifying element of type Microsoft.EnterpriseManagement.Configuration.ManagementPackRule with inner exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Microsoft.EnterpriseManagement.Configuration.ManagementPackRule.VerifyDataTypes(Dictionary`2 moduletypes) at Microsoft.EnterpriseManagement.Configuration.ManagementPackRule.Verify(VerificationContext context) at Microsoft.EnterpriseManagement.Configuration.Verification.VerificationEngine.VerifyCollectionItems(Object context) (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring)

 

The Investigation

 

Out of my almost 13 years for MP authoring experience I know most of the time this error above is due to a missing end tag $ of a property reference or a misspelled property name.

For example

<License>$Target/Property[Type=”OpsLogix.IMP.VMWare.VirtualMachine”]/LicenseKey</License>

Should be

<License>$Target/Property[Type=”OpsLogix.IMP.VMWare.VirtualMachine”]/LicenseKey$</License>

But this time it’s different … after doing some investigations by setting the management fragments “Build Action” to “None” in the VSAE project I found out that it was due to the external referenced datatasource Accessibility property.

The solution

 

So after I changed the Accessibility property of the external referenced datasource from :

<DataSourceModuleType
ID=OpsLogix.IMP.VMware.Collector.DataSource.LicenseActions
Accessibility=Internal
Batching=false>

To..

<DataSourceModuleType
ID=OpsLogix.IMP.VMware.Collector.DataSource.LicenseActions
Accessibility=Public
Batching=false>

… my project compiled fine.

What makes of course sense and if I was using the autocomplete in VSAE this was never happened since the autocomplete will not provide you any Internal references at all…. But of course to be faster I copied it over manually , so my bad … at the end I lost my time due to investigations anyway hope you won’t.

The end

 

Hope I saved you some time.

Happy scomming

Debugging SCOM Workflows using PowerShell

22 Oct

Hi,

As promised during one of the SCOM MP authoring trainings I gave, here’s a short post about how to debug your SCOM Management Pack workflows. ( So Patrick you can stop spamming me (lol) )

Currently we have 5 options for debugging your workflows:

  1. Eventlog
  2. WFAnalyzer
  3. Trace by PowerShell
  4. TraceConfig ETW Tracer
  5. Microsoft Message Analyzer ** will make a separate post this this soon **

Some short explanations:

1.Eventlog

Trace by looking at healthservice events or log messages that you have put into your PS/VBS probes. However this doesn’t provide any information on if a condition connection fails or the PB passed ect.

Look the Operationsmanager eventlog for the following event ids , note there are a lot more id but this ones will give you a first detection:

ID

Description

1103

Summary: xxxx rule(s)/monitor(s) failed and got unloaded, 1 of them reached the failure limit that prevents automatic reload. Management group “xxx”. This is summary only event, please see other events with descriptions of unloaded rule(s)/monitor(s).

1102

Rule/Monitor “%4” running for instance “%3″ with id:”%2” cannot be initialized and will not be loaded. Management group “%1”    

1101

Host reference in workflow “%4”, running for instance “%3″ with id:”%2” cannot be resolved. Workflow will not be loaded. Management group “%1”   

1206

Rule/Monitor “%2”, running for instance “%3″ with id:”%4” failed, got unloaded and reached the failure limit that prevents automatic reload. Management group “%1”.  

4510

The Health Service encountered an error %5 causing the rule “%2” running for instance “%3″ with id:”%4” in management group “%1”.   

5412

Converting data batch to XML failed with error “%6” (%5) in rule “%2” running for instance “%3″ with id:”%4” in management group “%1”.%n  %n  The rule will be unloaded.    

5401

Failed to replace parameter while creating the alert for monitor state change.

2.WFAnalyzer

This is a tool provided by Microsoft. You will have to copy it from the VSAE installation media to the scom server installation directory since it needs some extra dlls. See for VSAE here: https://www.microsoft.com/en-us/download/details.aspx?id=30169

When you start the program you will be asked to apply a MS server and the Agent to trace. After this you will see a running workflows table. Pick one workflow you want to trace and right click -> Trace. Now a new trace window will be started with the formatted output of the trace.

I must say that using this tool is a must have for SCOM MP authors…. If it works … since SCOM 2012 R2 and above most of the time it fails to start a trace.

If it crashes you could try to do this:

  1. Open as administrator a CMD
  2. Execute : “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StopTracing.cmd”
  3. Execute: “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StartTracing.cmd”
  4. Execute : “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StopTracing.cmd”
  5. Execute: “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\FormatTracing.cmd”

This will build new CAB/tmf files in the Tools (all.tmf) and Tools\TMF directory that is used to translate the ETW ids to readable messages.

And with a bit of luck it works. If it works, also have a look at the filter menu. Changing it to None will give you some more details if a WF fails.

Also keep in mind that this tool needs a SDK connection to execute the ‘get running workflows’ task and also to get WF/instance information from that task results. This information is used to provide you the UI table so you can select the WF to trace. So can I use it on a normal agent ? yes you can but as stated it needs a SDK connection to a MS server. Why ? When you start the WFanalyzer it will show you a box were you provide the SDK MS server and the Agent to debug. With this information it will trigger the task ‘get running workflows’ on that agent. The results are used to build a WF table. But again this is only for providing you the nice UI. Also I have rewritten the WFanalyzer UI a long time ago to fix this bugs and requirements as far I remember it was due to an invalid GUID that lets the UI table component crash when it updates the WF running states and also I changed the SDK connection mechanism to make it run on a agent. But due to MSFT copyright I can’t share it with you , sorry. (If someone from the MSFT SCOM team (Kevin ? ) reads this I am happy to share the issues I have fixed.)

But no worry , in the part below I explain how to do this using PowerShell so you don’t have this issues.

3.Trace by PowerShell

So If you can’t run the WFanalyzer as above. You could use the PowerShell scripts below.

What it will do:

  • Get the Workflow and Instance Id to trace
  • Create the TraceEnbled override and import the override MP
  • Start up a trace listener
  • Format real time the ETW messages to readable content and filter out some irrelevant strings
  • Stop the trace
  • Remove the override MP

If you run step 1,2 on a MS server to get the IDs you could use it to start the trace on a GW or Agent too.

Step 5 and 6 you should only run if you are done with tracing.

I have separate scripts for Rule , Monitor and Discovery WF tracing. See below:

Rule tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Target1”

$ruleName=“OpsLogix.IMP.Rule.Ping.WMIPingCheck”

## create override

$rule=Get-SCOMRule-name $ruleName

$ruleClass=get-scomclass id $($rule.Target).Id

$ruleTarget=Get-SCOMMonitoringObject Class
$ruleClass
|
?
{$_.Name like $targetName}

$ruleoverride=“<Overrides> <RulePropertyOverride ID=””DebugOverrideForRule$($rule.Name)”” Context=””$($ruleClass.Id)”” ContextInstance=””$($ruleTarget.Id)”” Enforced=””false”” Rule=””$($rule.Id)”” Property=””TraceEnabled””> <Value>true</Value> </RulePropertyOverride> </Overrides>”

$RuleMP=$rule.GetManagementPack()

$RuleMP.KeyToken

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($RuleMP.Name)”>

<ID>$($RuleMP.Name)</ID>

<Version>$($RuleMP.Version)</Version>

<PublicKeyToken>$($RuleMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<RulePropertyOverride ID=”DebugOverrideForRule$($rule.Name)” Context=”$($RuleMP.Name)!$($ruleClass.Name)” ContextInstance=”$($ruleTarget.Id)” Enforced=”false” Rule=”$($RuleMP.Name)!$($rule.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</RulePropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForRule$($rule.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 5
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack


 

Monitor tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Target1”

$monitorName=“OpsLogix.IMP.Monitor.Ping.WMIPingCheck”

## create override

$monitor=Get-SCOMMonitor name $monitorName

$monitorClass=get-scomclass id $($monitor.Target).Id

$monitorTarget=Get-SCOMMonitoringObject Class
$monitorClass
|
?
{$_.Name like $targetName}

$monitoroverride=“<Overrides> <MonitorPropertyOverride ID=””DebugOverrideForMonitor$($monitor.Name)”” Context=””$($monitorClass.Id)”” ContextInstance=””$($monitorTarget.Id)”” Enforced=””false”” Monitor=””$($monitor.Id)”” Property=””TraceEnabled””> <Value>true</Value> </MonitorPropertyOverride> </Overrides>”

$monitoMP=$monitor.GetManagementPack()

$monitoMP.KeyToken

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($monitoMP.Name)”>

<ID>$($monitoMP.Name)</ID>

<Version>$($monitoMP.Version)</Version>

<PublicKeyToken>$($monitoMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<MonitorPropertyOverride ID=”DebugOverrideForMonitor$($monitor.Name)” Context=”$($monitoMP.Name)!$($monitorClass.Name)” ContextInstance=”$($monitorTarget.Id)” Enforced=”false” Monitor=”$($monitoMP.Name)!$($monitor.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</MonitorPropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForMonitor$($monitor.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 5
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack


 

Discovery tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Vcenter01”

$discoveryName=“OpsLogix.IMP.VMWare.Discovery.Datacenter”

## create override

$discovery=Get-SCOMDiscovery name $discoveryName

$discoveryClass=get-scomclass id $($discovery.Target).Id

$discoveryTarget=Get-SCOMMonitoringObject Class
$discoveryClass
|
?
{$_.Name like $targetName}

$discoveryMP=$discovery.GetManagementPack()

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($discoveryMP.Name)”>

<ID>$($discoveryMP.Name)</ID>

<Version>$($discoveryMP.Version)</Version>

<PublicKeyToken>$($discoveryMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<DiscoveryPropertyOverride ID=”DebugOverrideForDiscovery$($discovery.Name)” Context=”$($discoveryMP.Name)!$($discoveryClass.Name)” ContextInstance=”$($discoveryTarget.Id)” Enforced=”false” Discovery=”$($discoveryMP.Name)!$($discovery.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</DiscoveryPropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForDiscovery$($discovery.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

md c:\temp Force

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 6
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch # | Select-Object Line | Out-StringNoWrap

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack

4.TraceConfig ETW Tracer

So if nothing above did help you getting a clue why your workflows are not working you a doomed to use the ETW tracer and go through tons of log lines….

For example you used 3 state monitor moduletype but specified only 2 state in the monitor…

To trace what is happening follow the steps below:

  1. Start a OpsMgrtrace using C:\Program Files\ Microsoft System Center 2016\Operations Manager\Server\Tools\TraceConfig.exe
  2. Select all trace providers from Trace Area: Healthservice and Modules
  3. Set the trace level to DEBUG
  4. Start the tracing
  5. After restarting the SCOM agent wait till you get the 1102 error
  6. Now stop the Trace
  7. Format the trace file to a log file . Use as Admin CMD and execute C:\Program Files\ Microsoft System Center 2016\Operations Manager\Server\Tools\FormatTracing.cmd
  8. Open the log file at : C:\Windows\Logs\OpsMgrTrace\OpsMgrCustom.log (tip VsCode is excellent for this)
  9. Look for the workflow name or
  10. Look for text : [ConfigurationManager] [] [Error] :CMonitoringResolver

For example:

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::LookupHealth{MEMonitoringResolver_cpp2945}Cannot resolve operational state.

[1]11632.15896::09/28/2017-14:45:27.661 [Common] [] [Error] :Common::ParameterReplacement::ReplaceCommon{ParameterReplacement_cpp615}`hr` failed, returning ERROR: {hr= 0x8000ffff(E_UNEXPECTED)}

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveOperationalStates{MEMonitoringResolver_cpp1022}Common::ParameterReplacement::Replace failed with code 0x8000ffff(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveOperationalStates{MEMonitoringResolver_cpp960}ResolveOperationalState failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveMonitorModules{MEMonitoringResolver_cpp425}ResolveOperationalStates failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CWorkflowsLoader::LoadUnitMonitor{MEWorkflowsLoader_cpp2877}ResolveMonitorModules for ‘OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor’ failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CWorkflowsLoader::LoadUnitMonitor{MEWorkflowsLoader_cpp2877}ResolveMonitorModules for ‘OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor’ failed with code -2147418113(E_UNEXPECTED).

[0]11632.15896::09/28/2017-14:45:15.632 [HealthServiceCommon] [] [Error] :EventLogUtil::LogEvent{EventLogUtil_cpp379}Logging event 1102 from source “HealthService” with severity Error and description “Rule/Monitor “OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor” running for instance “Backup state for DB11G07″ with id:”{7F1A7474-5A4F-6856-32D7-7FAA6022EC73}” cannot be initialized and will not be loaded. Management group “OM2012SP1Grp01″”.

Solution found to fix this :

Check the <operationalStates> it should match the 2 or 3 states defined the monitormoduletype.

For example the error above missed the Warning state.

<OperationalStates>

<OperationalState ID=”UIGeneratedOpStateIda836de3b0d3645dca0ecdc3b6374c3e4″ MonitorTypeStateID=”Healthy” HealthState=”Success” />

<OperationalState ID=”UIGeneratedOpStateIdaaa73a3abd5144eaa6bff6d72e1d3aaa” MonitorTypeStateID=”Warning” HealthState=”Warning” />

<OperationalState ID=”UIGeneratedOpStateIdc415176391694409926e21afb666c532″ MonitorTypeStateID=”Critical” HealthState=”Error” />

</OperationalStates>

The End

So hope this helps you getting to know why a workflow is not running OR what data a workflow is passing in a PropertyBag.

When I have some time left (and that’s spare) I will finish my post on using Microsoft Message Analyzer for SCOM WF tracing.

Happy SCOMMING

SCOM console could not load Scheduled Reports Subscriptions

8 Aug

 

 

A quick note since I could not find it on the web.

 

Today I had a call with a customer. He had a issue with opening the Scheduled Reports view in the SCOM console.


 

He got the error below:

 


 

The error was as cryptic as we are used to known form MSFT :

 

System.NullReferenceException: Object reference not set to an instance of an object.

 

Note:  The following information was gathered when the operation was attempted.  The information may appear cryptic but provides context for the error.  The application will continue to run.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.EnterpriseManagement.Mom.Internal.UI.Reporting.ManagementGroupReporting.GetSubscriptions(String owner)
   at Microsoft.EnterpriseManagement.Mom.Internal.UI.Reporting.Views.ReportSubscriptionsView.ReportSubscriptionsView.LoadSubscriptionsJob(Object sender, ConsoleJobEventArgs args)

 

So I looked at the subscriptions table in the reporting database where the subscriptions are stored:

SELECT
*
FROM [ReportServer].[dbo].[Subscriptions]

And all the 40 subscriptions where there.

So what could be the issue ?

After some digging it seems that the delivery option EMAIL was missing .


 

So by running the Reporting Services Configuration Manager and configure the email settings again it all started to work again

 

 

So happy SCOMMING again

 

Michel

 

 

Using PowerShell to add update and delete Class instances in SCOM

29 Nov

Challenge

This short post will provide some PowerShell scripting to let you play with class instances in SCOM. Since there’s not much information on the web on this topic and I had a request from a partner I will provide some code below how to handle this.

In the examples below I will use a class from the OpsLogix VMware management pack, but you can use any (public) class you want. All code just be run on a SCOM MS server. All examples are separate runnable.

Add a class instance

In the example below, I will add a new VMWare ESX host to a datacenter belonging to a vCenter connection. As below:

Before we run the script, we will have to know the Key properties so we can configure the parent child relationship. In this case the we have the following relationship:

vCenter01:7443 -> Datacenter01 -> My_ESX_Host

In this case the Host we want to add is called “My_ESX_Host” and we set the “AssetTag” to “unkown” .

## ======================================================================

## example script how to add a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##================= create/add class instance

$ClassObject
=
New-Object
Microsoft.EnterpriseManagement.Common.CreatableEnterpriseManagementObject($mg,$class)

# set the KEY props

$ClassObject[$Class.FindHostClass().FindHostClass(),“vCenterHostName”].Value = “vCenter01:7443”

$ClassObject[$Class.FindHostClass(),“DatacenterName”].Value = “Datacenter01”

$ClassObject[$Class,“ESXServerName”].Value =
$ClassInstanceDisplayName

# Set NON key props

$ClassObject[$Class,“AssetTag”].Value = “unkown”

# add and write back to scom

$discovery
=
New-Object
Microsoft.EnterpriseManagement.ConnectorFramework.IncrementalDiscoveryData

$discovery.Add($ClassObject)

$discovery.Overwrite($mg)

##================= END ================================================

Change a property of a class instance

Below we change a property called “AssetTag” to “test tag 123” of the ESXHost class instance “My_ESX_Host”. Keep in mind that only NON-Key properties can be changed.

See script below:

## ======================================================================

## example script how to change a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##================= change property of class instance

## get the just created class

$ClassInstance
=
Get-SCOMMonitoringObject
-Class
$Class
|
where { $_.DisplayName -eq $ClassInstanceDisplayName}

# change the properties

# only NON-KEY props can be changed

$ClassInstance[$Class,“AssetTag”].Value = “test tag 123”

# write it to scom

$ClassInstance.Overwrite()

##================= END ================================================

Delete a Class Instance

In this example we delete the ESXHost class instance “My_ESX_Host”.

## ======================================================================

## example script how to delete a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##============== remove a class instance

## get the class instance to remove

$ClassInstance
=
Get-SCOMMonitoringObject
-Class
$Class
|
where { $_.DisplayName -eq $ClassInstanceDisplayName}

# add the class instance to delete

$discovery
=
New-Object
Microsoft.EnterpriseManagement.ConnectorFramework.IncrementalDiscoveryData

$discovery.RemoveInternal($ClassInstance,$ClassInstance.GetClasses()[0])

## execute the delete

$discovery.Commit($mg)

##================= END ================================================

Happy SCOM’ing

Michel Kamp

TOUCHING SCOM

https://michelkamp.wordpress.com/

O no I forgot my SCOM account passwords!!

25 May

 

Problem:

O no I forgot my SCOM account passwords!! I don’t know the password of the Data Access, Data Reader and Writer account anymore. Resetting it in AD will force me to do a lot of tweaking to correct the accounts in SCOM.

Don’t worry we will find them for you.

Analyse:

 

SCOM stores the account passwords in the “Run AS Configuration -> Accounts” section. This account information is linked to a “Run As profile”. This Run as Profile can be assigned to a SCOM Workflow (Rule/Monitor/Task…) so that this workflow is going to run under the account security context.

 

Nice but we still can’t see the password on the accounts.

 

Solution:

 

But we can also do other things with the Run As profile. We can just assign them as a parameter to for example a script. In the script we can readout the account information and find our lost password.

In SCOM we can use the secure script provider (vbscript) aka “Microsoft.Windows.ScriptWriteAction”. The secure script provider streams the run as information as an input stream to the VBScript. So if you read this input stream at top of your script you will get the account information. This can be tricky sometimes.

See an example below:

<WriteActions>

<WriteAction ID=”sc” TypeID=”Windows!Microsoft.Windows.ScriptWriteAction”>

<ScriptName>ScriptName.vbs</ScriptName>

<Arguments />

<ScriptBody><![CDATA[ Set oAPI = CreateObject(“MOM.ScriptAPI”)

Set oArgs = WScript.Arguments

 

password= WScript.StdIn.ReadLine()

Call oAPI.LogScriptEvent(“ScriptName.vbs”, 101, 2, “Debug password = ” & password)

]]></ScriptBody>

<SecureInput>$RunAs[Name=”RUNAS_PROFILE_1″]/UserName$ $RunAs[Name=” RUNAS_PROFILE_1″]/Password$</SecureInput>

<TimeoutSeconds>300</TimeoutSeconds>

</WriteAction>

</WriteActions>

 

Using the SecureInput parameter we can provide the Run as account information. For getting the UserName we use :

$RunAs[Name=”RUNAS_PROFILE_1“]/UserName$

And for the password we use

$RunAs[Name=”RUNAS_PROFILE_1“]/Password$

The RUNAS_PROFILE_1 is the internal name of the Run as profile in SCOM. You can use Powershell “Get-SCOMRunAsProfile” to get the internal names.

I hear you thinking, this is way too old, this is VBScript, we WANT PowerShell! And I agree completely.

So for PowerShell we can use the normal PowerShell script provider aka “Microsoft.Windows.PowerShellProbe”. We don’t have to apply a secureinput parameter but just very simple supply the RunAs as a normal parameter. And this will do the trick.

<ProbeAction ID=”Probe” TypeID=”Windows!Microsoft.Windows.PowerShellProbe”>

<ScriptName>DisplayCerdentials.ps1</ScriptName>

<ScriptBody><![CDATA[Param(

$USERNAME,

$PASSWORD

)

 

# output the input paramters

Write-Output “UserName: $USERNAME”

Write-Output “Password: $PASSWORD”

 

# end script

 

]]></ScriptBody>

<SnapIns />

<Parameters>

<Parameter>

<Name> USERNAME </Name>

<Value>$RunAs[Name=”MSDL!Microsoft.SystemCenter.DataWarehouse.ActionAccount”]/UserName$</Value>

</Parameter>

<Parameter>

<Name> PASSWORD </Name>

<Value>$RunAs[Name=”SC!Microsoft.SystemCenter.DatabaseWriteActionAccount”]/Password$</Value>

</Parameter>

 

</Parameters>

<TimeoutSeconds>300</TimeoutSeconds>

<StrictErrorHandling>true</StrictErrorHandling>

</ProbeAction>

 

Now we make a simple workflow for example a task and add use this probeaction.

Concussion

 

You see it’s very simple to get account information that’s stored in the run as accounts / profiles. If this is good is up to you.

To make it even easier I created a MP that will display the most important account information (so the usernames and passwords).

You simply import the MP and select the Managementserver target and press the special task “GetRunAsCredentials”.

The account information will be displayed in the task output.

 

Download link for the Management Pack:

https://onedrive.live.com/redir?resid=A6ECD6E173E79D82!137890&authkey=!AEuYWi5Z6etHxno&ithint=file%2cxml

NOTICE: Please remember that the task output is stored in the SCOM Databases so it can be traced back not very secure I think. So use this only in emergencies. Or change the PowerShell script to write it to a file!!

 

Happy SCOMMING!

Michel Kamp

Touching SCOM

https://michelkamp.wordpress.com