Posts

Showing posts with the label Windows service management

Automating Windows Service Management with a Simple PowerShell Script

Here's a simple PowerShell script that will start and restart a service. You can modify it by changing the name of the service you want to start/restart. # Start service Start-Service -Name "NameOfService" # Wait for service to start Start-Sleep -Seconds 5 # Restart service Restart-Service -Name "NameOfService" In this script, we first use the Start-Service cmdlet to start the service with the specified name. We then use the Start-Sleep cmdlet to wait for 5 seconds to give the service time to start up fully. Finally, we use the Restart-Service cmdlet to restart the same service.