Intune Remediation · Starts the ScreenConnect client service if it stopped
Test in a pilot group before you point this at the fleet. Detection exits 1 to trigger remediation, 0 to stay put.
Detection Script
D
Detect stopped ScreenConnect service detection
Exits 1 (non-compliant) to trigger remediation. Exits 0 if clean.
›
# Flags a stopped ScreenConnect client service.
$svc = Get-Service 'ScreenConnect Client*'
if (-not $svc) {
Write-Output 'Compliant: not installed'
exit 0
}
if ($svc | Where-Object Status -ne 'Running') {
Write-Output 'Non-compliant: stopped'
exit 1
}
Write-Output 'Compliant'
exit 0
Remediation Script
R
Start the service remediation
Runs only when detection exits 1.
›
# Sets the service to automatic and starts it.
Get-Service 'ScreenConnect Client*' | Where-Object Status -ne 'Running' | ForEach-Object {
Set-Service $_.Name -StartupType Automatic
Start-Service $_.Name
}