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
$publish.GacInstall("$TargetFolder\Microsoft.EnterpriseManagement.Core.dll")

$publish.GacInstall("$TargetFolder\Microsoft.EnterpriseManagement.OperationsManager.dll")

$publish.GacInstall("$TargetFolder\Microsoft.EnterpriseManagement.Runtime.dll")

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.

 

 

 

 

 

 

LAB Build Out – Part 8 – Installing SCOM 1801 from VHD Evaluation

In this session, we will be installing System Center Operations Manager (SCOM) 1801 from the VHD Evaluation.

SCOM 1801 is the 1st Semi annual channel release for SCOM. The System Center suite of products now come in (2) distinct support branches.

The Semi-Annual-Channel branch (SAC) will:

  • Receive all new updates planned for the product
  • Be supported for 18 months
  • Have new releases every 6 months

The Long-Term-Servicing Channel (LTSC) branch will:

  • Receive UR (Update rollups) releases that will primarily focus on fixes and not new features.
  • Supported for 5 years in mainstream support

Read more about the System Center 1st Semi Annual Channel Release here:  https://azure.microsoft.com/en-us/blog/first-system-center-semi-annual-channel-release-now-available/

Download System Center Evaluations: https://www.microsoft.com/en-us/evalcenter/evaluate-system-center-release

Please read the guide included with the evaluation download for details on how to create a new virtual machine to accept the VHD disk. I will not be covering this during the session.