≡ Menu

PowerShell: How to use SCOM cmdlets from normal powershell window

SCOM 2007 offers a customized poweshell console from where you can run all cmdlets related to SCOM. This powershell consoles comes along with SCOM management console installation. The only problem with this is it’s flakiness. I somehow don’t like this console and never felt like working on a powershell console. If you type “Get-” and press TAB, it should show all the cmdlets which starts with GET- but this console hangs and never gives me control back. There I realized the need for running these commands from normal powershell consoles so that everything works as expected and scripts also can make use of this environment. By default, if you launch a normal poweshell window from SCOM server where SCOM powershell console installed, you won’t get SCOM cmdlets by default. You need to load them explicitly.

So, in this post I will give you the list of steps required to load SCOM module into normal powershell window.

  1. Go to Start->RUN-> type “powershell.exe”
  2. In powershell window, type Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
  3. Now connect to SCOM server by typing New-ManagementGroupConnection -ConnectionString:MYSCOMSRV1 where MYSCOMSRV1 is your SCOM RMS server.
  4. Now let us set the path for SCOM by typing Set-Location ‘OperationsManagerMonitoring::’

 

This completes the import process of SCOM module into normal powershell windows and now you can use alll SCOM cmdlets from this console. Similarly if you have any scripts which uses powershell module, just  prefix your code with above steps so that SCOM module will get imported before the code in your scripts starts using any SCOM cmdlet.

I guess no need to say that you can import the SCOM module into normal powershell console only computer where SCOM management tools are installed.

Hope this halpe.. Happy learning..