Posts

Showing posts with the label execution policy

How to: Create a Windows Service Kickstarter using Powershell

Since some legacy Windows services are getting more and more unstable and fall apart without any means of recovery, a kickstarter is needed to ensure those important(?) services don't just disappear quietly without any struggle. The idea is to use a combination of Powershell script and Task Scheduler to trigger the job every now and then. 0. Precondition The Windows Server 2003 R2 does not come with Powershell installed. To allow Powershell scripts to run on the machine, follow the link to download and install it, and bear in mind, system reboot will NOT be required. 1. Powershell Script Powershell is really easy to pick up. It only requires basic knowledge of Command Prompt, and the rest is just C#. function ServiceKickstarter($serverName, $serviceName) {       $service = Get-Service -ComputerName $serverName -Name $serviceName     if ($service.Status -eq "Stopped")     {         ...