Thursday, July 17, 2014

Useful SCOM 2007 R2 Powershell

Get list Operations Manager Commands

Get list of unavailable/unresponsive agents
Get-Monitoringclass -name "Microsoft.Windows.Computer" | Get-MonitoringObject | Where-Object {$_.IsAvailable -eq $False} | Select-Object DisplayName, IsAvailable | Format-Table

Resolve the healthserviceid to Agent Name
Get-Agent | Where-Object {$ -eq "healthserviceid"} | Select-Object name

Export All Unsealed Management Packs to UnsealedMPBackup Folder
Get-ManagementPack | where {$_.Sealed -eq $false} | Export-Managementpack -path C:\UnsealedMPBackup

Get the Management Server information including the Management Server Action Account identity
Get-ManagementServer | Select-Object DisplayName, IsRootManagementServer, ActionAccountIdentity, HealthState | Format-Table -autosize

Get the User Roles and its Members
Get-Userrole | Select-Object DisplayName, Users

Export all rules in imported management packs to rules.csv
Get-rule | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},DisplayName | sort-object -property MP | export-csv "c:\rules.csv"

Get List of agent managed machines and their ip address
Get-agent | format-list -property, displayname, IPAddress

Enable Agent Proxy for all agents where it is disabled
$NoProxy = get-agent | where {$_.ProxyingEnabled -match "false"}
$NoProxy|foreach {$_.ProxyingEnabled = $true}
$NoProxy|foreach {$_.ApplyChanges()}

No comments:

Post a Comment