Hello Gurus
I have got a question which I can’t find an answer to.
I have got a script(I didn’t write it), which looks at the names of certain alerts and then changes it on SCOM 2012. I have created the it looks like the following:
param ($rootMS)
$rootMS=”
#Initializing the Ops Mgr 2007 Powershell provider
add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin ;
set-location “OperationsManagerMonitoring::” -ErrorVariable errSnapin ;
new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin ;
set-location $rootMS -ErrorVariable errSnapin ;
$Alerts = get-alert -criteria ‘Name = ”IIS 7 Web Site is unavailable”’ | Where {$_.ResolutionState -eq 0}
foreach($Alert in $Alerts)
{$Alert.ResolutionState = 20
$Alert.Update(“Resolution State Changed”)}
It works when I run it from the powershell window but doesn’t seem to work from the command channel i.e, the alerts get changed when I run it manually it works and the . My command channel looks like this:
Full path of the command line:
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
Command line parameters:
“C:\Temp\ChangeResState_IIS.ps1″ ‘$Data/Context/DataItem/AlertId$’
Startup folder for the command line:
c:\windows\system32\windowspowershell\v1.0\
I have also tried C:\Temp\ChangeResState_IIS.ps1 and C:\Temp as the Command line parameters:and Startup folder for the command line:without any luck.
I have looked in a lot of different articles but there seems to be a lot of contradictory directions on what the command channel should be.
I think the command line parameter might be wrong. Also should the startup folder be what it is or should that be changed. I am new to SCOM and powershell, please help? Any help will be greatly appreciated.
Thanks in advance.
Regards,