Archive by category "System Center"

Create test alert in SCOM

There is no standard feature in SCOM to generate a test alert, which can be needed to test a mail subscription.
For SCOM2007 there is a simple tool to generate test alerts. Too bad that this tool doesn’t support SCOM2012.
If you are using SCOM2007 you can download the tool here: http://blogs.technet.com/b/momteam/archive/2009/05/19/notifications-test-tool.aspx

For the SCOM2012 users we can generate a test alert with a Microsoft Event log event.
First we need to create an event log entry. This can be done with PowerShell or a CMD Command.

Create event in Windows Event log

I’ve done this with the standard EventCreate command in CMD.
eventcreate /L Application /T information /ID 999 /D “This is a test event” /SO TestEvent

If you want to create a daily test event, this can be scheduled in task scheduler.

Sample parameters:
– Run whether user is logged on or not
– Run with highest privileges
– Program/script: eventcreate
– Arguments: /L Application /T information /ID 999 /D “This is a test event” /SO TestEvent

Create an Event Monitor in SCOM

  • Go to the Authoring tab -> Monitors -> Create a unit monitor.
  • Create a new management pack: “Test event management pack” Or use (not the default) a other unsealed management pack.
  • Choose Windows Events -> Simple event detection -> Timer reset.
  • Give it a name, and select the target. I’ve chosen the “Operations Manager Management Server Computer Group” because i generate the test event on my SCOM Management server.
  • I’ve chosen the “configuration” parent monitor because this is a typical configuration thing.
  • Select the event log we are monitoring for the event.
  • Next, type the Event ID (999) and the Source (TestEvent).
  • Configure the timer when the test alert can be closed.
  • Configure the Severity and Priority and Select the “Generate alerts for this monitor” box.

Now you can test Alerts with running the scheduled task or run the command in the DOS prompt.

Delete dependencies Default Management Pack

Default Management Pack Information

Don’t save any custom rules, overrides or views to the default management pack. Store al application specific overrides in a new unsealed application overrides MP. Or when the overrides are customer based, create an unsealed customer management pack. When this is done, you can simply delete application specific or customer specific overrides.
Now with the rule above in your mind, we are going to delete al the dependencies in the default management pack.

SCOM Reporting Overrides Report.

With this report its possible to locate overrides saved in the Default Management Pack.
If there is some override made, locate the monitor or rule and go to the override summery to delete the overrides.
After this step, try to delete the Management Pack. Same situation? Go to the second step.

SCOM XML Management pack editing:

The default management pack is an unsealed management pack with the real name “Microsoft.SystemCenter.OperationsManager.DefaultUser”. Unsealed Management Packs like all SCOM handmade management packs can be edited.
Export the Default Management pack 2 times, first on your backup location and second one witch you going to edit.
There are four sections in the management pack:
– Manifest: Contains the name of the management pack and the references.
– Monitoring: Contains the monitoring and override definitions.
– Presentation: Contains the views and folders.
– Language Packs: Contains readable names for objects instead of unreadable system guides.

When you have deleted all overrides on monitors and deleted al the views the reference section in the XML is the issue. So first delete the references:

Delete all <Reference Alias= </Reference> for each Management Pack that must be removed.

Example Advisor:

In my situation was this enough to delete the management pack. Because I had delete the overrides and views in the SCOM UI.

Save the XML, and import the management pack again. When importing the management pack, this will be trowed: Default Management Pack version 7.1.10226.0 is imported. Click install.

When there are still dependencies on the management pack, safely remove the dependent overrides, monitors and views in the other 3 sections based on the management pack you want to remove. The example formats are:

 

Run SCOM Discovery task manually

Sometimes it takes up to 24 hours to discover a new component or new installed role. If there is no time to wait 24 hours to complete this discovery you can do this manually.
There is a nice task in the SCOM console to get this discovery started.

First search the Discovery ID and Instance ID. This can be done with some PowerShell one-liners:

Then search the “Trigger On Demand Discovery” button in your SCOM Console.
Is placed under the folder -> Operations Manager -> Agent Details -> Agent Health State -> Select Object -> Task plane (scroll down) -> Trigger on demand discovery

Then Override the task parameters with your id found in the steps above:
Override Task Parameters SCOM

Get duplicate MAC Address PowerShell VMM

Duplicate mac addresses can result in strange situations in your environment, losing connections etc.
This is a simple script to filter all the duplicate mac addresses.

Set VM Cloud and User Role with VMM PowerShell

When you install Azure Pack you need to add a cloud and userole on each VM.
Manually this is a boring click job..

PowerShell makes this a lot easier, first change the cloud and then the user role:

 

Error: VMM Host not responding

First of all check if your VMM SA Account is member of the local administrators group on each Hyper-v node.
Then open the VMM Console and right-click on the host that’s experiencing issues and chose properties -> status.

– Network: Some network issues, most cases VMM can’t reach the VMM agent. Check DNS, Ports and ping.

Ports used by VMM Agent:
Hyper-V Host (VMM agent) Ports: 80/135/139/445        WinRM/RPC/NetBIOS/SMB (TCP)
Hyper-V Host (File transfer) Port: 443 or 80                     HTTPS/HTTP Using Bits
Hyper-V Host (Control channel) Ports: 5985/5986          WS-Management

– WinRm: Check if WinRm is working on the Hyper-v node:

Configure the WinRm service to run in a separate Svchost.exe process. You can check this with Process explorer from Sysinternals witch can be download from here.

If WinRm is not running in a separate svchost process.
Open an elevated command prompt:

You get this output if the command was succesful:
[SC] ChangeServiceConfig SUCCESS

And increase the limits of WinRm:

Try a refresh in VMM..

– Host agent service: Restart the VMM Agent on the host with this PowerShell command:

– Host agent version: Update the VMM Agent version if it is older than the VMM Console.
– WMI Performance Counter: If you have some WMI related issues you can restart the SCOM Agent try to clear the SCOM Health cache..

 

If WMI Still corrupted you can try to performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository, with this command:

When this fails you can try a full reset of the WMI Repository with this command:

 

If the Winrm commands fails, look if the winRM working correctly with this command:

With a working config the output looks like this:

Listener [Source=”GPO”]
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = THE IPADRESSES

With a bad config try a new quick config of WinRm:

 

Delete VM From VMM Database

Firtst, try to remove the VM with the VMM Powershell module:

If this was not succesvol you can try this:
This is a sweaty hand job, but in most cases succesful..

On your VMM Management server, stop VMM Management service and VMM Agent.
Login to your SQL Management Studio and start a Query against your VirtualManagerDB.
First search for the ID, the Spooky VM have:

After you get the ID, past this ID in the following 3 sections of code in the GUID section:

 

Hyper-v VM migration with VMM Powershell

Somethimes you need to bulk migrate some Hyper-v virtual machines.
This is not possible with the VMM gui.

In this situation PowerShell can help:
Filter on VMname

Replace the $VM line when you need to migrate all the machines placed on a specified host:

 

 

 

 

List all Hyper-v snapshots with the VMM PowerShell Module

There is no place where you can find an overview from all Hyper-v snapshots in the VMM Gui.
In this situation PowerShell is your friend. With a few lines of PowerShell code is this overview simple to make.

Run this commands in an elevated PowerShell  prompt where you installed the VMM Console: