Friday 5 December 2008
Operations Manager Data Warehouse High CPU Utilization
http://www.afinn.net/2008/10/operations-manager-data-warehouse-high-cpu-utilization/
Wednesday 8 October 2008
Speed up Command Shell startup
I then ran the same script from within the command shell and it found something to NGEN
NGENing : Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll
In my very scientific way of couting seconds in my head before and after running this it definitley starts faster.
Check it out - http://blogs.msdn.com/powershell/archive/2008/09/02/speeding-up-powershell-startup-updating-update-gac-ps1.aspx
Friday 3 October 2008
Clearing Console Cache and User Settings
There are a few steps to be taken to really clean up a console if you have performed some personalization.
Open regedit and delete the key HKEY_CURRENT_USER\Software\Microsoft\Microsoft Operations Manager\3.0\Console
Start the Operations Console from the command line with the option /clearcache
Example:
C:\Program Files\System Center Operations Manager 2007\Microsoft.MOM.UI.Console.exe" /clearcache
Thursday 14 August 2008
Quick Access to OpsMgr Agent Information
Here is a powershell script that extracts information from OpsMgr and drops it into several HTML files so it can be added to a website.
Download Script
The pages created are the following
AgentsCounts.html - This gives give you a count of the number of agents per management group and breaks this down also by per management server
MonitoredServers.html - This page gives a complete list of all the agents being monitored by Opsmgr.
ServersDown.html - This gives a list of servers that may be down. It is actually a list of servers where the health service watcher is in an "Error" state.
AgentsLast7days.html - This is a list of all agents installed in the last 7 days, when they were installed and includes their health state
The script does require some configuration before it can be used:
1) At the very start of the script you have to enter the name of the Root Management Server. You can uncomment the next lines lines and define multiple RMS's if you want to pull the information from more than 1 management group.
2) $outpath = "c:\" - Change this to where you want the script to write the html files.
3) If connecting to more than one management group you need to comment out line 17 and uncomment Line 19
Tuesday 12 August 2008
Updated Agent Maintenance Mode
---Update---
Updated version of this MP at http://derekhar.blogspot.com/2009/11/new-agent-maintenance-mode.html
---------
There is a new version of my Maintenance Mode MP and scripts that can do maintenance mode from the Agent with no extras installed (The original post is here). The 4 files are available for download from http://cid-397bb61b75cc76c5.skydrive.live.com/browse.aspx/Public/AgentMaintModeV2?view=details
-----------
EDIT
Be aware the PowerShell execution policy might block the script from being run.
You may need to do the following:
1. Open the Command Shell, and do "set-executionpolicy remotesigned" (using "allsigned" may be considered a bit more secure.
2. Right-click on the .ps1 files, chose properties and click "Unblock" especially if you've downloaded these scripts using Internet Explorer.
Thanks to Marco for catching this. I had a few people contact with with the earlier version not working and I could never figure out why. Could be the same reason.
----------------
This version adds the ability to turn off maintenance mode from the agent as well as turn it on. The vbscript has been updated with some more options and some instructions on how to use it.
To install or update you need to import the management pack and copy the 2 ps1 files to System Center Operations Manager 2007 program folder on the RMS.
Then you need to copy the vbscript file to any agent managed server and run it to set any server in maintenance mode for the desired time period.
------------------------------
VBScript Usage:
Usage: MaintMode ON|OFF [ON Duration][D][H][M]
Examples: MaintMode ON 6H
MaintMode ON 2D
ON is a mandatory keyword to put a server in maintenance mode.
ON Duration is number of [D]ays [M]inutes or [H]ours Maintenance
Mode should remain ON.
If not specified, the default is 6 hours.
This means Maintenance mode will turn itself OFF after 6 hours.
If ON Duration is specified without [D][H][M], the number is
interpreted as hours.
------------------------------
This MP creates a new class which contains all Windows Operating Systems. There are 2 rules in this class. One listens for the Maint Mode ON event and the other listens for the Maint Mode OFF event. The script on the RMS that turns on Maintenance Mode actually turns it on for all the components of the server and then turns it off again only for the Maint Mode class. This means that even in Maint Mode it can listen for the OFF event.
NOTE: The discovery for this class runs every 12 hours so be aware that systems may take this long after install for the scripts to work
Thanks again to Boris for his examples and scripts for doing maintenance mode.
Tuesday 19 February 2008
Initiate Maintenance Mode from an Agent (no extras installed)
---Update---
Updated version of this MP at http://derekhar.blogspot.com/2009/11/new-agent-maintenance-mode.html
---------
This post will detail a method to initiate Maintenance Mode from an agent managed computer using a vbscript. This method is useful in the case where the people doing patching are not the same people who use the Operations Console and when you cannot dictate what is to be installed in the server. Clive Eastwood's AgentMM for example, if run remotely requires .NET 3.0, Operations Manager specific dll's, Admin permissions on OpsMgr and the ability to connect to the SDK service on the RMS.
Using this method, the person running the command needs to have absolutely no permissions on Ops Manager. All of the components required to have this function are part of a standard OS with and agent installed. It works through Gateways so can be used in firewalled or untrusted environments if you have a gateway in place.
There are 3 parts to this solution:
1) A VBScript on each managed computer that writes an event to the local event log.
2) A Management pack containing an rule that detects this event and runs a response on the RMS.
3) The response executes a Powershell script on the RMS that puts the server in to Maintenance Mode. I have borrowed pieces of the powershell script from Boris.
The vbscript is pretty simple and just writes an event to the event log that indicates the length of time Maintenance Mode should remain on. This time is passed as a parameter to the script.
Usage: MaintModeOn 4
- This command turns on Maintenance Mode for 4 hours
The single rule in the management pack picks up the event from the Application Log with event ID of 0, with a source of WSH and where the description contains the words "Maintenance Mode". In response, the rule runs the Powershell script MaintModeON.ps1 and passes to it two parameters -the name of the computer where the script was run and the event description.
The Powershell script puts all three pieces of an agent in the Maintenance Mode. This Powershell script should be copied to the System Center Operations Manager 2007 program folder on the root management server. If you have clustered the RMS it should be in the folder on both nodes.
---Update---
I have updated the links since google appears to have taken down the site hosting the files.
Tuesday 11 September 2007
XPath statements to display event data in monitors and rule-generated alerts.
Here are the XPath statements to display event data in monitors and rule-generated alerts.
Monitors
$Data/Context/EventDescription$
Rule-Generated Alerts
$Data/EventDescription$
Thursday 19 July 2007
More about Property bags and Varant types
The XML generated by the Authoring console will look something like:
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="String">7</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
If returning Integer values that you want to compare with integers you will have to change it to:
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">7</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
Note that the Type declaration has to be on both sides of the expression. Also be aware that some version of the Authoring console may strip the Type="Integer" from the XPath query.
Thanks to Alexandre Coelho for this fix.
Tuesday 17 July 2007
Export a Sealed MP
Export a Sealed MP
A sealed MP can be exported to an XML file using Command Shell.
Find the correct name of the MP you want to export using:
get-managementpack | where {$_.Name -like "*Server.2003"}
Export using:
get-managementpack | where {$_.Name -eq "Microsoft.Windows.Server.2003"} | export-managementpack -path C:\MP
Monday 16 July 2007
Property bags and Variant Types
<Property Name="scan.dat" VariantType="3">19</Property>
<Property Name="names.dat" VariantType="3">19</Property>
<Property Name="clean.dat" VariantType="3">19</Property>
</DataItem>
The XML describes that this is a property bag, that date/time that it was submitted to the management server and the properties contained in the property bag.
The VariantType describes the type of the value that is returned. The variant types are:
Empty = 0
Null = 1
Short = 2
Integer = 3
Single = 4
Double = 5
Currency = 6
Date = 7
String = 8
Object = 9
Error = 10
Boolean = 11
Variant = 12
DataObject = 13
Decimal = 14
Byte = 15
Char = 16
Long = 17
Friday 13 July 2007
Some Ops manager Agent Stuff
To Create the Uninstall Task
On the Authoring pane on the console create a new command line agent task called CompleteUninstall. The target is Windows Computer. The command line settings are shown below.

Uninstall command for Agent (RTM)
MsiExec.exe /x {E7600A9C-6782-4221-984E-AB89C780DC2D} /quiet
This gives us a task that ca be run on an agent to perform an uninstall of an agent. To run this on all agents the easiest way is to do it in a powershell script
Powershell Script to run the task for all agents
$uninstallTask = get-task | where {$_.Name -eq "CompleteUninstall"}
foreach($agent in get-agent)
{
$server = $agent.Displayname
$server
start-task -asynchronous -task:$uninstallTask -path .\Microsoft.SystemCenter.AgentManagedComputerGroup\$server
}
Save this script as a .ps1 file and then run it from the Operations Manager Command Shell. The results of these tasks will always show in the Operations Console under Task Status as failed as the Agent has been removed.