Using the OpsMgr Provider in a PowerShell Script

How can you load the OpsMgr Provider as part of a PowerShell script?

$rms = “yourRMSservernamehere”

if(-not (Get-PSSnapin | Where-Object {$_.Name -eq “Microsoft.EnterpriseManagement.OperationsManager.Client”}))
    {
    Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
    }
New-managementGroupConnection -ConnectionString:$rms
Set-Location “OperationsManagerMonitoring::” -ErrorVariable errSnapin ;
Set-Location $RMS -ErrorVariable errSnapin ;

 

 
Comments

No comments yet.

Leave a Reply