Using the SCOM Powershell modules without installing the Console

Today we will be exploring how to use the SCOM Powershell modules without installing the console. By default when you install the SCOM Console on a server or workstation the SCOM PowerShell modules also get installed. Normally, this is the only way to gain access to most of the SCOM Powershell modules. However, by manually copying over the requisites pieces and a few OS tweaks you can use the SCOM PowerShell modules without installing the console.

In order to get started you will need the following:

  • An existing server/workstation with the SCOM Console already installed
  • An existing server/workstation running a supported OS

In this example I will be using a Windows Server 2012 R2 system to deploy the SCOM PowerShell modules. The SCOM environment is a SCOM 1801 deployment. The folders and path may vary if you are using a SCOM 2012, 2012 R2, or 2016 deployment but the steps are essentially the same.

Step 1

Create a temporary folder on your target workstation/server. In my case I am creating a folder named E:\SCOM-Powershell.


Step 2

Connect to a server/workstation that has the full SCOM console already installed and copy the [Install-Drive]:\Program Files\ Microsoft System Center\Operations Manager\PowerShell folder to your temporary folder from Step 1 ex: E:\SCOM-PowerShell.  In this case, I am connecting to the server via a network share and copying the files over from the SCOM-SAC1 server which is a management server that also has the SCOM Console installed.

Note: Your path may vary slightly if you are running SCOM 2012, 2012 R2, or 2016 in all steps.

Step 3

In the temporary folder from Step 1, create a folder named Console and a folder named Server.

Step 4

You will need to copy the following (3) DLLs from your source computer:

  • Microsoft.EnterpriseManagement.Core.dll
  • Microsoft.EnterpriseManagement.OperationsManager.dll
  • Microsoft.EnterpriseManagement.Runtime.dll

The path will vary depending on if the source computer in question is a SCOM management server or a workstation with the console installed and also depending on if it is for SCOM 2012, 2012 R2, 2016, or 1801.

If you are using a SCOM management server browse to the following path:  [Install-Drive]:\Program Files\ Microsoft System Center\Operations Manager\Server\SDK Binaries

If you are using a workstation with the console installed browse to the following path:  [Install-Drive]:\Program Files\ Microsoft System Center\Console\SDK Binaries

Copy the (3) DLLs to your temporary folder from Step 1. ex: E:\SCOM-PowerShell

Step 5

After you have copied the folder, created the empty folders, and copied the DLL files you should have a temporary folder that looks something like this:

Now, on your target workstation, open an Administrator PowerShell command prompt or the Administrator PowerShell ISE and copy and paste the PS code below.  Replace the $TargetFolder variable with the path to your Temporary folder. This will register the DLL’s on your system.

# Replace the TargetFolder with your Temp Folder Path
$TargetFolder = "E:\SCOM-PowerShell"
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null 
[System.EnterpriseServices.Internal.Publish] $publish = New-Object System.EnterpriseServices.Internal.Publish



Step 6

Lastly, you need to add the SCOM PowerShell module path to the local environment variables. In PowerShell run the following command against your workstation replacing the path with your temp folder.

$CurrentValue = [Environment]::GetEnvironmentVariable(“PSModulePath”, “Machine”)
[Environment]::SetEnvironmentVariable(“PSModulePath”, $CurrentValue + “;$TargetFolder\PowerShell\OperationsManager”, “Machine”)
Import-Module $TargetFolder\PowerShell\OperationsManager\OperationsManager.psd1

Step 7

Close and reopen your PowerShell command prompt or PowerShell ISE session, now The SCOM PowerShell modules should be available and accessible on the target workstation/server. You can test by opening a PowerShell window and attempting to run the following SCOM cmdlets using an account that has permissions within the Management group:

import-module OperationsManager
New-SCOMManagementGroupConnection [EnterAManagementServerNameHere]
Get-SCOMAlert -resolutionstate 0

The (3) commands above will attempt to connect to a SCOM management server and display all of the alerts with a resolution state of ‘New’.

Let me know if you have trouble with any of this with various OS/PowerShell versions/SCOM versions. This has been tested using a SCOM 1801 environment with a Server 2016 and Server 2012 R2 as the target workstation.







You May Also Like

About the Author: ljohnson

Leave a Reply

Your email address will not be published. Required fields are marked *