3 Replies Latest reply on Oct 8, 2018 9:27 AM by SitzRieSe

    Advanced Patch Management - Prompt for restart

    JHammo Apprentice

          With APM after patches are installed on a computer, when you are prompted to restart the computer and you select no.  When will the user be prompted to restart the machine again?  And is this interval something that I can change?  Also can I set a maximum amount of time that they can delay a restart?

       

      thanks

       

      Jason

        • 1. Re: Advanced Patch Management - Prompt for restart
          SitzRieSe Expert

          Hi Jason,

           

          the user should be ask in the next installer run again. You can change this intervall in the infrastructure task under DSM Runtime Service. You cant set a maximum, we disabled this function completely and run a escript as job to get this function.

           

          regards

           

          Alex

          • 2. Re: Advanced Patch Management - Prompt for restart
            JHammo Apprentice

            thanks for the response, would you be willing to share the basics of your escript file and how you got this to work?  I would much rather right my own escript logic, but not sure how I would add this to the APM config.  Would I modify the APM Mangement Job escript package directly?

             

            thanks

             

            Jason

            • 3. Re: Advanced Patch Management - Prompt for restart
              SitzRieSe Expert

              Hi Jason,

               

              im sorry theres alot of work in this script. I dont want to publish this in here. But you should get it working with this:

               

              !check for pending reboots

              If IsRestartFlagSet

              Set('_RebootPending','true')

              If RegKeyExistsEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending',reUseX64Hive)

              Set('_RebootPending','true')

              If RegKeyExistsEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired',reUseX64Hive)

              Set('_RebootPending','true')

              If RegKeyExistsEx('HKEY_LOCAL_MACHINE\SOFTWARE\NetSupport\PatchManagement\RebootRequired',)

              Set('_RebootPending','true')

              If RegValue('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager','PendingFileRenameOperations',reUseX64Hive)<>''

              Set('_RebootPending','true')

              !check the system uptime

              WMIGetIndexData('\\.\root\cimv2','Win32_PerfFormattedData_PerfOS_System','0','WMI_')

              SystemUpTime

              EndProc

               

              With the first part you will check if a reboot is required and than you can handle the request about the reboot. You should create a new escript. You dont have to editing the existing apm script. You cant do that and I wouldnt recommend that. If you create a new escript and your logic is working, you can assign it to "managed users & computers" object as a job policy. We choosed "once a day". So the script will check if a reboot is required, if the system has an uptime of 3 days or more, the user will be asked for a reboot. If he choose "No", the script will runs in the next day. So the user wont get the message again on the same day, because the script is runs just once a day. The script counts the times when the user said no to the reboot. You can use the "IncrementVar" command for this. This gave you the possibility to say that the user can skipped the reboot for just 3 times, after that the user wont get the choice and can just click ok.

               

              To get the current count of skips, we setup a registry key and modify it every time the user said no. At the beginning of the skript we read the registry key to get the current count.

               

              I hope that helps you

               

              regards

               

              Alex