SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Making an Operations Manager Module

Operations Manager 2007 R2 ships with Operations Manager Shell which is simply a provider with associated cmdlets for working with System Center Operations Manager. The Operations Manager implementation of PowerShell uses a console file which limits reusability, however we can easily build our own Operations Manager Module…

Creating the Module

This is a technique I learned from Joel Bennett (blog|twitter) and previously applied to SQL Server in my post Making A SQLPS Module. To create a module simply copy the OpsMgr.psd1 file to your $home\Documents\WindowsPowerShell\OpsMgr directory and run the commented out code to copy the necessary files. As mentioned in the comments the files are available on any machine with the Operations Manager Shell installed, however once the module has been created you can copy the module folder and files to machines without the Operations Manager Shell or client installed.

How Do You Use the Operations Manager Shell?

Import the module and call the Start-OperationsManagerClientShell function:

import-module OpsMgr; Start-OperationsManagerClientShell -ManagementServerName: "MyOpsMgrServer" -PersistConnection: $true -Interactive: $true;

One “real-life” use is to put server in maintenance mode so alerts aren’t generated while performing system maintenance. See this post for details on putting a server in maintenance mode.

Chad Miller

Chad Miller is a Senior Manager of Database Administration at Raymond James Financial. Chad has worked with Microsoft SQL Server since 1999 and has been automating administration tasks using Windows Powershell since 2007. Chad is the Project Coordinator/Developer of the Powershell-based Codeplex project SQL Server PowerShell Extensions (SQLPSX). Chad leads the Tampa Powershell User Group and is a frequent speaker at users groups, SQL Saturdays and Code Camps.


No comments.

Leave a Comment

Please register or log in to leave a comment.