Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Scheduling Operations Manager Maintenance mode?

$
0
0

I'm trying to schedule Stephan Stranger's SCOM Maintenance mode script.  The issue is that I don't see a good way to pass the parameters the scripts is looking for via the Scheduled Task.

Is there a good way to pass the scripts needed parameters like group name and maintenance mode duration?  Maybe I need to write a batch file and call the .ps1 and arguments from the .BAT - I've been playing with the .BAT for over an hour and can't that to work either.

Currently when I create a scheduled task with these settings:

Program/script:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Add Aurguments (optional): 

-noexit C:\Scripts\MaintMode\Start-SCOMMaintenanceModeForGroups.ps1 "TestingDSRGroup" -endtime 5 -reason "unplannedother" -comment "Testing DSR Group" -Verbose

It seems to just run in the background with out popping up a powershell window and will eventually end with a (0x1) Last Run Result.

Here is the syntax that works great from with in powershell with Stephan's script but I can't seem to work from a scheduled task:

C:\Scripts\MaintMode\Start-SCOMMaintenanceModeForGroups.ps1 "Testing DSR Group" -endtime 5 -reason "unplannedother" -comment "Testing DSR Group" -Verbose

Any assistance appreciated.



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>