Hi, one of our Developers has asked for some script they can add to their deployment that will put a particular monitored service on a specific server into MM for a set amount of time and then check the status afterwards to make sure it is running. Has anyone got anything handy?
You don’t have to install the console, but you do need to load the module. You can copy the files out of your server and add them to a share or something. import the module with unc path, import-module \\myserver\psmodule\operationsmanager\OperationsManager.psd1Another alternative is to run your script in a console task, but this isn’t available trough squaredup or you can develop your own tool.
Personally, depending on how often this happpens or if it’s technically possible for the application, i would just disable the service, which also supress monitoring. and enable it when done
sc config “Servicename” start=demand
sc config “Servicename” start=auto
One way is to use the PowerShell script here, and put the specific service as the only item in a group. Running the script will put the service into maintenance mode for the specified duration. I don’t know if you could replace the group elements in the script with the actual service, that would have to be tested, and may not be worth the hassle when the group works.
Also, the status is apparent as, when it comes out of maintenance mode, it will automatically raise an alert if it isn’t running. Or someone else with better PowerShell knowledge can suggest a modification to report the status.