Windows PowerShell commandlets for System Center 2012 R2 Operations Manager

The newest member on the A-Team, Dhanraj, takes the stage to give us some insight on SCOM and Windows PowerShell.

Windows PowerShell is Microsoft’s task automation and configuration management framework, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems. More and more Microsoft products are being shipped with their custom made Powershell cmdlets with a view to empower admins to perform complex tasks using simple lines of code.

Let’s start out with a few examples that we use frequently. The URL’s present after each commandlet:

1. Enable-SCOMAgentProxy – This is used in cases where the agents needs to act like a proxy and discover other objects. An example being the AD management pack.

Enable-SCOMAgentProxy [-Agent] <AgentManagedComputer> [[-PassThru]] [-Confirm] [-WhatIf] [ <CommonParameters>]

2. Get-SCOMAgent – Gets the agent-managed computers in a management group.

Parameter Set: Empty
Get-SCOMAgent [-ComputerName <String> ] [-Credential <PSCredential> ] [-SCSession   <Connection> ] [ <CommonParameters>]

Parameter Set: FromAgentNames
Get-SCOMAgent [-DNSHostName] <String> [-ComputerName <String> ] [-Credential <PSCredential> ] [-SCSession <Connection> ] [ <CommonParameters>]

Parameter Set: FromManagementServer
Get-SCOMAgent [-ManagementServer] <ManagementServer> [-ComputerName <String> ] [-Credential <PSCredential> ] [-SCSession <Connection> ] [ <CommonParameters>]

3. Get-SCOMDatabaseGroomingSetting – Operations Manager database in order to maintain performance.

Get-SCOMDatabaseGroomingSetting [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

4. Set-SCOMDatabaseGroomingSetting – Once you have had a look at your Database grooming settings using the Get-SCOMDatabaseGroomingSetting, this command will let you modify the settings based on your requirement.

Set-SCOMDatabaseGroomingSetting [-AlertDaysToKeep <Byte> ] [-AvailabilityHistoryDaysToKeep <Byte> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-EventDaysToKeep <Byte> ] [-JobStatusDaysToKeep <Byte> ] [-MaintenanceModeHistoryDaysToKeep <Byte> ] [-MonitoringJobDaysToKeep <Byte> ] [-PassThru] [-PerformanceDataDaysToKeep <Byte> ] [-SCSession <Connection[]> ] [-StateChangeEventDaysToKeep <Byte> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

5. Get-SCOMDataWarehouseSetting – The Get-SCOMDataWarehouseSetting cmdlet gets the data warehouse settings for a management group.

Get-SCOMDataWarehouseSetting [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

6. Set-SCOMDataWarehouseSetting – Use the Set-SCOMDataWarehouseSetting to modify data warehouse settings for a management group.

Set-SCOMDataWarehouseSetting [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-DatabaseName <String> ] [-PassThru] [-SCSession <Connection[]> ] [-ServerName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

7. Get-SCOMOverride – This is a very useful cmdlet that usually comes in handy when you need to have a quick look at all the overrides that are present on a preconfigured environment.

8. Get-SCOMRMSEmulator – The Get-SCOMRMSEmulator cmdlet gets the management server that hosts the root management server (RMS) Emulator role. The RMS Emulator gives legacy management packs that depend on RMS the ability to continue working in System Center 2012 – Operations Manager, which does not support a root management server. Additionally also have a look at the Set-SCOMRMSEmulator and Remove-SCOMRMSEmulator.

9. Install-SCOMAgent – Deploys one or more System Center Management agents using push install.

Install-SCOMAgent -DNSHostName <String> -PrimaryManagementServer <ManagementServer> [-ActionAccount <PSCredential> ] [-AgentActionAccount <PSCredential> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

For a complete list of SCOM cmdlets, please refer to the following link:

Happy Reading!