Scheduling OpsMgr PowerShell scripts
When scheduling an Operations Manager PowerShell script you have to load the powershell snapins.
Insert this in the beginning of your script
_$ServerName = “hostname”
add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”;
set-location “OperationsManagerMonitoring::”;
new-managementGroupConnection -ConnectionString:$ServerName;
set-location $ServerName;_
Written on September 17, 2009