This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Am using Patch Manager to install updates, how can I run a script to stop a service

How can I use Package Boot Manager to stop a service before updating by running a powershell script, I have had a look at creating a package but this is asking me for an Msi, Exe file which I do not have.

The updates are downloaded by Group Policy to the servers, Patch Manager then runs a task to install the updates.

  • You can stop/start and change the startup type of services with patch manager packages as part of the Package Boot Editor. service.PNG

  • But how do you get to this point, I do not have an msi, exe file, It is just a scheduled task to install updates. This is what is stopping me.

  • So, if you have the script to do the service stopping for you look into packaging up the powershell script as an exe file. I have done it with Admin Script Editor, thought it is an older/no longer updated tool. I'm sure there alternatives out there as well.

    Once packaged as an exe, you could package that file up.

  • But why go to all this bother just to stop a service, might as well leave it as it is, much less work.

  • There is another way you might accomplish this with Patch Manager, but it would run & be scheduled as a separate task from the update deployment task.   For that reason, you might have to schedule it to run a few minutes before the update installation task.

    To do it, in Patch Manager:

    1. Target a machine that you know has the service in question (left-click it to Select it).
    2. Right-click that machine and choose the Computer Explorer option.
    3. Once Computer Explorer opens, go to the Services tab and select the Service that you want to stop.
    4. On the upper right, there is an option to 'control service'
      serv1.png
    5. Once you click that you'll get a dialog where you can choose to stop the service:
      serv2.png
    6. After that, you'll get the standard computer selection and scheduling dialogs so you can target the machine(s) or group that you want to hit and schedule it to run a few minutes before your update deployment task.    In theory you could run a similar task later to start the service again (though if you are rebooting the machine after updating you might not need to do that, assuming that the service is one that will be started after bootup).
  • Thank you Kellytice, this looks promising. Why this function was not included in a task is beyond me, this is an essential part of patching some machines.

  • Hi, I know this post was a while ago now but did you ever find a good way to stop services on servers before patching them via windows updates? I have to stop services on a couple of services before patching can take place.

  • If you haven't found a solution yet, this might be of help Re: How to run a script after installation?

  • This thread may be a bit old, but just in case someone stumbles on it:   There is now (as of Patch Manager 2.1.6) the ability to run PowerShell scripts before or after update deployment tasks.

    So, if you schedule a deployment task (Update Management or Update Management Wizard) you can enable that option.

    Here is a screenshot showing that option on an Update Management Wizard task:

    powershell option.png

    More info:

    Push the updates with Windows PowerShell scripts

    (note: this newer feature is totally unrelated to the script option in individual 3rd party update packages)

  • Why does the documentation not reflect the screen shot you have provided?  Is the documentation from a pre-release version?  There is no mention of remote/local scripts. emoticons_sad.png