Automate Windows Service Recovery Today. Operations professionals often face downtime due to failed Windows services, leading to productivity loss.
Manually tracking and restarting these services can be a time-consuming and error-prone process.
Step 1 — Save the script
Open Notepad and paste the script below. Save it as:
C:\Scripts\ServiceMonitor.ps1Create the folder first if it doesn't exist — open File Explorer, go to C:\ and create a new folder called Scripts.
The Script:
PowerShell
# Auto-Remediate Failed Windows Services
# Automate & Operate — automateandoperate.com
$services = @(
"wuauserv",
"Spooler",
"W32Time",
"eventlog"
)
$smtpServer = "smtp.gmail.com"
$smtpPort = 587
$from = "[email protected]"
$to = "[email protected]"
$username = "[email protected]"
$password = ConvertTo-SecureString "yourpassword" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
$logFile = "C:\Logs\ServiceMonitor.log"
if (-not (Test-Path "C:\Logs")) {
New-Item -ItemType Directory -Path "C:\Logs"
}
foreach ($serviceName in $services) {
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($service -eq $null) { continue }
if ($service.Status -ne "Running") {
try {
Start-Service -Name $serviceName
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$message = "$timestamp — RESTARTED: $serviceName"
Add-Content -Path $logFile -Value $message
Send-MailMessage `
-From $from -To $to `
-Subject "ALERT: $serviceName restarted on $env:COMPUTERNAME" `
-Body "$message`n`nAutomate & Operate" `
-SmtpServer $smtpServer -Port $smtpPort `
-UseSsl -Credential $credential
} catch {
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content -Path $logFile -Value "$timestamp — FAILED: $serviceName — $_"
}
} else {
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content -Path $logFile -Value "$timestamp — OK: $serviceName is running."
}
}Update these 3 lines with your details:
$from— your Email address$to— where alerts should go$password— your password or app password
Step 2 — Set up Task Scheduler
Press Windows key → type Task Scheduler → open it
Click "Create Basic Task" in the right panel
Name it:
Service MonitorClick Next
Trigger: select Daily → click Next
Start time: set to today, any time
Click Next
Action: "Start a program" → click Next
Program:
powershell.exeArguments:
-ExecutionPolicy Bypass -File "C:\Scripts\ServiceMonitor.ps1"Click Next → Finish
Set it to repeat every 5 minutes:
Right click your new task → Properties
Click Triggers tab → Edit
Check "Repeat task every" → set to 5 minutes
Duration: Indefinitely
Click OK → OK
Step 3 — Test it
Open PowerShell as administrator and run:
powershell
powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\ServiceMonitor.ps1"Check C:\Logs\ServiceMonitor.log to confirm it's logging correctly.
Why This Matters: Automating service remediation eliminates the 2am phone call. Once this runs, failed services restart themselves in under 5 minutes with zero human intervention. Your log file gives you a full audit trail for compliance and troubleshooting.
Call to Action: Reply to this email if you hit any issues setting this up — I read every reply.
Automating the remediation of failed Windows services minimizes downtime and reduces the manual workload on operations teams. By implementing this PowerShell solution, you ensure critical services are always up and running, which enhances overall system reliability. Furthermore, proactive monitoring allows for quicker response times, preventing larger issues down the line.
Start automating your Windows service recovery today to boost efficiency!
Your prompts are leaving out 80% of what you're thinking.
When you type a prompt, you summarize. When you speak one, you explain. Wispr Flow captures your full reasoning — constraints, edge cases, examples, tone — and turns it into clean, structured text you paste into ChatGPT, Claude, or any AI tool. The difference shows up immediately. More context in, fewer follow-ups out.
89% of messages sent with zero edits. Used by teams at OpenAI, Vercel, and Clay. Try Wispr Flow free — works on Mac, Windows, and iPhone.
Claude is not just a chatbot anymore. Is your security team ready?
Claude.ai is one thing. Claude Cowork with MCP connections, running agentic workflows, taking actions across your data with ungoverned skills? That is a different conversation entirely, and most security teams are not equipped to govern it.
Harmonic Security is built to secure everything Claude offers. Full browser controls for Claude.ai, deep governance over agentic MCP workflows, and real-time visibility into what Claude is doing across your organization. So your CISO can say yes to the tools your business is already demanding.

