Powershell: create Windows event log

Create a NT eventlog for testing event monitor or rules:

Write-Eventlog -Logname ‘Application’ -Source ‘Hyperion EPMA DimensionServer’ -EventID 0 -EntryType Error -Message “This is a test of Gustavo Mendez (SCOM)”



More informationhttp://technet.microsoft.com/en-us/library/hh849847.aspx

To write an event to an event log, the event log must exist on the computer and the source must be registered for the event log.

The cmdlets that contain the EventLog noun (the EventLog cmdlets) work only on classic event logs. To get events from logs that use the Windows Event Log technology in Windows Vista and later versions of Windows, use Get-WinEvent.


Find the groups that belongs a Scom agent

# ——————————————————————————————————————–
# Name: Get-GroupsForOneObject.ps1
# Author: Gustavo Méndez, 23/08/2013
# Version: 1.0
# Description: Displays all groups that one Scom agent belongs
# Change value of variable $stringObject by the server name to find
# ——————————————————————————————————————

# Initialize hashtable array (index will be the group name)


# Declare object to find

$stringObject=”Object Name or Server Name”;

# Find and save the Scom object

$Class = get-monitoringclass -name “Microsoft.SystemCenter.Agent”;

$objectToFind = Get-MonitoringObject -monitoringclass:$Class | ? {$_.displayname -match $stringObject}

# If object is null exit

If (!($objectToFind))
write-host “It doesn’t exist or it could be for example a VMware virtual machine server discovered by Veeam MP without Scom agent”;


# Obtain groups

$mg = (Get-ManagementGroupConnection).ManagementGroup;

$groups = $mg.GetRootPartialMonitoringObjectGroups() | sort DisplayName;

# Find the object in each group

foreach ($group in $groups)

$groupMembers = $group.GetRelatedPartialMonitoringObjects([Microsoft.EnterpriseManagement.Common.TraversalDepth]::OneLevel);

# If group contain members…

if($groupMembers.Count -ne 0)


# Compare each member group with the object to find

foreach ($groupMember in $groupMembers)


if ($groupMember.displayname -match $objectToFind)


# Add group to array

$array.$objectToFind += (“$group, “);





$array.GetEnumerator() | Sort-Object Name | Out-GridView; # Print results in a new window;

First steps in Visual Studio Authoring Extensions

  1. MVP Pro Speaker Series:Tips & Tricks to Using the Visual Studio Authoring Extensions: http://blogs.technet.com/b/wincat/archive/2013/05/01/mvp-pro-speakers-series-tips-amp-tricks-to-using-the-visual-studio-authoring-extensions-level-300.aspx
  2. First steps in Visual Studio Authoring Extensions for System Center 2012 – Operations Manager: http://social.technet.microsoft.com/wiki/contents/articles/5236.visual-studio-authoring-extensions-for-system-center-2012-operations-manager.aspx
  3. Visio Management Pack Designer for System Center 2012 – Operations Manager (with exercises): http://social.technet.microsoft.com/wiki/contents/articles/5235.visio-management-pack-designer-for-system-center-2012-operations-manager.aspx.

Next the exercises to download:

Operations Manager Management Pack Examples – Health Model: http://gallery.technet.microsoft.com/Operations-Manager-9185d978

Operations Manager Management Pack Examples – Service Model: http://gallery.technet.microsoft.com/Operations-Manager-0bdbdac7