Overview

This guide prepares a Windows Server so Callgoose SQIBS can fix incidents on it automatically. The automation runner connects over SSH with a key, and runs PowerShell 7 scripts, such as clearing space or restarting a service, the moment an incident opens.

You need
Windows Server 2019 or 2022 with admin rights, and a Linux automation runner
Setup time
About 30 minutes
Result
SQIBS runs PowerShell fixes on the server

Step 1: Install PowerShell 7

In Windows PowerShell as Administrator (or download the MSI from the PowerShell releases page):

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
pwsh --version

Step 2: Turn on the OpenSSH server

In PowerShell as Administrator:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
Get-Service -Name sshd

Allow SSH through Windows Firewall (Windows usually adds this rule itself; run it if it is missing):

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

Allow port 22 only from your automation runner, not from everywhere.

Step 3: Make PowerShell 7 the SSH shell

By default, SSH sessions open cmd.exe. Switch them to PowerShell 7:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
Restart-Service sshd

Step 4: Sign in with a key, not a password

  1. On the automation runner (Linux), create a key for this purpose:
ssh-keygen -t ed25519 -f ~/.ssh/callgoose_windows
  1. Add the public key (callgoose_windows.pub) as a line in C:\ProgramData\ssh\administrators_authorized_keys on the server (for an administrator account). Add it to the file; do not overwrite keys already there.
  2. Set the file's permissions, which OpenSSH requires:
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
Restart-Service sshd

Step 5: Test a script over SSH

Save this as C:\scripts\check_disk_space.ps1 on the server:

# Lists free space on every local fixed drive
Get-CimInstance -ClassName Win32_LogicalDisk |
  Where-Object { $_.DriveType -eq 3 } |
  Select-Object DeviceID,
    @{Name = "Size (GB)";      Expression = { "{0:N2}" -f ($_.Size / 1GB) }},
    @{Name = "FreeSpace (GB)"; Expression = { "{0:N2}" -f ($_.FreeSpace / 1GB) }}

Then, from the runner:

ssh -i ~/.ssh/callgoose_windows Administrator@<windows-server> "pwsh -File C:\scripts\check_disk_space.ps1"

You see each drive with its size and free space. If you are asked for a password, check the key file and its permissions.

Step 6: Use it in SQIBS

  1. Create a PowerShell profile with the server and the SSH key, and a PowerShell action with your fix script.
  2. Add the action to an automation workflow.
  3. Link the workflow to the API filter that opens the incident, as below.

To troubleshoot SSH on the server, set LogLevel VERBOSE in C:\ProgramData\ssh\sshd_config, restart sshd, and read the OpenSSH/Operational log in Event Viewer.

Fix known issues automatically

Many alerts have a known fix: restart a service, clear a full disk, run a health check. SQIBS can run that fix for you the moment the incident opens. This is event-driven auto remediation. For example, when your monitoring tool reports low disk space on a Windows server, SQIBS runs a PowerShell script that clears temporary files and checks the space again.

Incident opens
Workflow starts
SQIBS runs the automation workflow linked to the filter.
Fixed
Incident resolved
The issue is fixed before anyone has to step in.
Not fixed
Escalated to the engineer
After the waiting time you set, the escalation policy pages on-call as usual.

Safe by design. SQIBS runs only workflows your own engineers wrote and approved for your environment. Nothing is guessed or generated: the same steps an engineer would run by hand, run sooner. If the workflow does not fix the issue, the engineer is paged as usual.

To set it up, in the same API filter:

  1. Select Workflow: choose the automation workflow to run when this filter opens an incident.
  2. If success then make incident resolved: turn on to resolve the incident when the workflow succeeds.
  3. Waiting time for escalate to escalation policies: how many minutes to give the workflow before paging the on-call engineer.

Start with low-risk workflows, such as a health check, and add fixes as you come to trust them.

Learn more: