Skip to main content

Service Restart Template

Summary

Restarts a service on the endpoint.

Example Agent Procedure Log

  • 1:17:23 PM 18-Oct-22 Windows Update Service Restart - Success THEN provaltech.com/dan.hicks
  • 1:17:23 PM 18-Oct-22 Windows Update Service Restart-0003 - bits, wuauserv Restarted Successfully on endpoint. provaltech.com/dan.hicks
  • 1:17:23 PM 18-Oct-22 Windows Update Service Restart - Raw PS1 Data: WARNING: Waiting for service 'Background Intelligent Transfer Service (bits)' to start... WARNING: Waiting for service 'Background Intelligent Transfer Service (bits)' to start... Name Success ---- ------- bits True wuauserv True provaltech.com/dan.hicks
  • 1:17:23 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System) - Success THEN provaltech.com/dan.hicks
  • 1:17:22 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0016 - Powershell command complete. Results returned to global variable #global:psresult# and saved in Agent's Documents tab of server. provaltech.com/dan.hicks
  • 1:17:22 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0016 - Informational: GetFile command overwrote the server file C:/Kaseya/UserProfiles/735959849026022/GetFiles/../docs/psoutput.txt with the new contents from c:/provaltech/psoutput.txt in THEN step 3. provaltech.com/dan.hicks
  • 1:17:12 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0011 - Executing 64-bit Powershell command as System: "" -command "%ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService.ps1 -ServiceNames bits,wuauserv" >"c:/provaltech/psoutputtmp.txt" provaltech.com/dan.hicks
  • 1:17:12 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0013 - Sending output to global variable. provaltech.com/dan.hicks
  • 1:17:12 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0008 - Custom commands detected as %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService.ps1 -ServiceNames bits,wuauserv provaltech.com/dan.hicks
  • 1:17:12 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0003 - No powershell file variable detected. provaltech.com/dan.hicks
  • 1:17:11 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0002 - Powershell is present. provaltech.com/dan.hicks
  • 1:17:08 PM 18-Oct-22 Windows Update Service Restart-0001 - Previous log saved as %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService-log-20221018011704.txt provaltech.com/dan.hicks
  • 1:17:08 PM 18-Oct-22 Write text to file - Success THEN provaltech.com/dan.hicks
  • 1:17:07 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System) - Success THEN provaltech.com/dan.hicks
  • 1:17:07 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0016 - Powershell command complete. Results returned to global variable #global:psresult# and saved in Agent's Documents tab of server. provaltech.com/dan.hicks
  • 1:17:07 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0016 - Informational: GetFile command overwrote the server file C:/Kaseya/UserProfiles/735959849026022/GetFiles/../docs/psoutput.txt with the new contents from c:/provaltech/psoutput.txt in THEN step 3. provaltech.com/dan.hicks
  • 1:17:04 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0011 - Executing 64-bit Powershell command as System: "" -command "$time = Get-ChildItem -Path %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService-log.txt | select-object -ExpandProperty CreationTime; $time = (Get-Date).ToString('yyyyMMddhhmmss'); $time" >"c:/provaltech/psoutputtmp.txt" provaltech.com/dan.hicks
  • 1:17:04 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0013 - Sending output to global variable. provaltech.com/dan.hicks
  • 1:17:04 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0008 - Custom commands detected as $time = Get-ChildItem -Path %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService-log.txt | select-object -ExpandProperty CreationTime; $time = (Get-Date).ToString('yyyyMMddhhmmss'); $time provaltech.com/dan.hicks
  • 1:17:04 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0003 - No powershell file variable detected. provaltech.com/dan.hicks
  • 1:17:03 PM 18-Oct-22 Execute Powershell Command (64-bit, Run As System)-0002 - Powershell is present. provaltech.com/dan.hicks
  • 1:17:01 PM 18-Oct-22 Windows Update Service Restart-0001 - Previous run detected. Renaming Existing Log provaltech.com/dan.hicks
  • 1:17:01 PM 18-Oct-22 Execute Powershell Command - Success THEN provaltech.com/dan.hicks
  • 1:17:01 PM 18-Oct-22 Execute Powershell Command-0011 - Powershell command completed! provaltech.com/dan.hicks
  • 1:16:59 PM 18-Oct-22 Execute Powershell Command-0011 - Executing powershell "" -Command "New-Item -Type Directory -Path $env:ProgramData/_automation/AgentProcedure -name ServiceRestart" "" provaltech.com/dan.hicks
  • 1:16:59 PM 18-Oct-22 Execute Powershell Command-0010 - Not sending output to variable. provaltech.com/dan.hicks
  • 1:16:59 PM 18-Oct-22 Execute Powershell Command-0008 - New command variable is: -Command "New-Item -Type Directory -Path $env:ProgramData/_automation/AgentProcedure -name ServiceRestart" provaltech.com/dan.hicks
  • 1:16:59 PM 18-Oct-22 Execute Powershell Command-0008 - Custom commands detected as New-Item -Type Directory -Path $env:ProgramData/_automation/AgentProcedure -name ServiceRestart provaltech.com/dan.hicks
  • 1:16:56 PM 18-Oct-22 Execute Powershell Command-0002 - Powershell is present. provaltech.com/dan.hicks
  • 1:16:48 PM 18-Oct-22 Run Now - Windows Update Service Restart - Admin provaltech.com/dan.hicks scheduled procedure Run Now - Windows Update Service Restart to run at Oct 18 2022 1:16 PM

Dependencies

EPM - Windows Configuration - Agnostic - Invoke-RestartService

Process

Calls the agnostic content to force a service restart on the endpoint. Performs any necessary log archival and reports to the Agent Procedure Log.

Output

  • %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService-log.txt
  • %ProgramData%/_automation/AgentProcedure/ServiceRestart/Invoke-RestartService-UNIXDATE-log.txt (archive of previous log)
  • Agent Procedure Log