Skip to content

Correcting course

Every failing check comes with a way to fix it.

Take the helm

Take the helm gives your team step-by-step instructions. Where they apply, steps cover:

  • The fleet-wide fix first: the Intune or Group Policy setting, or the admin center path
  • A single-device fix, with the exact PowerShell command
  • Warnings where a change could break something, such as checking for old devices before disabling SMBv1, or confirming another admin account works before removing one

Find it in the side panel of any finding under Correct course, or in a report under the Correct course menu. Every check's steps are also in the check reference.

After you make a fix, the next scan confirms it. On the device page, the Logbook shows the check as Back on course.

Fix script

The fix script is a PowerShell script that applies the settings Trimtab's Windows checks look for. It doesn't use Group Policy, so it works on every edition of Windows 10 and 11, including Home, and on devices with no domain or Intune.

  • From the Bridge: on a Windows device page, select Fix script. You get a copy with that device's failing and warning checks already filled in. Each finding the script covers says so under Correct course.
  • For a whole baseline: download the script without a check list, and it covers every check it can fix.

Run it in an elevated PowerShell, or as SYSTEM from your RMM or Intune:

Command What it does
.\Set-TrimtabBaseline.ps1 Preview: lists each change it would make. Changes nothing.
.\Set-TrimtabBaseline.ps1 -Apply Applies the standard fixes.
.\Set-TrimtabBaseline.ps1 -Apply -IncludeOptIn Also applies the opt-in fixes.
.\Set-TrimtabBaseline.ps1 -Checks HRD-002,AUD-003 -Apply Applies only the checks you list.
.\Set-TrimtabBaseline.ps1 -Apply -LockoutMinutes 30 Locks accounts for 30 minutes after 10 wrong passwords, instead of 15.

Account lockout is 15 minutes by default. PCI DSS requires at least 30, so when a client has PCI DSS, the Bridge's copy of the script sets 30.

Opt-in fixes can break older apps or change what people see, so they run only with -IncludeOptIn: attack surface reduction rules, the logon banner (set its wording with -BannerTitle and -BannerText), NetBIOS, USB write blocking, FIPS mode, LSA protection, legacy TLS, and the Windows Update policy cleanup. Preview them and test on one device first.

Manual checks are listed but never changed by the script, because they need a person: BitLocker, the TPM and Secure Boot, tamper protection, removing admin rights, LAPS, Credential Guard, installing updates, restarting, upgrading Windows, and enrolling in management. Follow their Take the helm steps.

When the script finishes, it starts a Lookout scan, so the Bridge shows the result within a few minutes. Some changes take effect after a restart; the script tells you when. It exits with code 1 if any fix fails, so your RMM flags the run.

The script
Set-TrimtabBaseline.ps1
# Trimtab fix script: applies the settings Trimtab's Windows checks look for. Works on Windows 10 and 11
# (Home, Pro, Enterprise, Education) without Group Policy. Run elevated, or as SYSTEM from an RMM or Intune.
# Guide: https://docs.trimtabsec.com/using/correct-course/#fix-script
#
#   .\Set-TrimtabBaseline.ps1                  Preview: lists what would change. Changes nothing.
#   .\Set-TrimtabBaseline.ps1 -Apply           Applies the standard fixes.
#   .\Set-TrimtabBaseline.ps1 -Apply -IncludeOptIn
#                                              Also applies opt-in fixes, which can break older apps or
#                                              change what users see. Preview them and test first.
#   .\Set-TrimtabBaseline.ps1 -Checks HRD-002,AUD-003 -Apply
#                                              Applies only the listed checks.
#   -LockoutMinutes 30                         How long accounts stay locked after 10 wrong passwords
#                                              (default 15). PCI DSS requires at least 30; the Bridge
#                                              sets 30 for clients with PCI DSS.
#
# Checks that need a person (BitLocker, LAPS, admin rights, firmware, enrollment) are listed as manual.
# Afterward, a Trimtab Lookout scan starts so the Bridge shows the result.

param(
    [string[]]$Checks = @(),
    [switch]$Apply,
    [switch]$IncludeOptIn,
    [ValidateRange(1, 99999)][int]$LockoutMinutes = 15,
    [string]$BannerTitle = 'Notice',
    [string]$BannerText = 'This computer is for authorized use only. Activity may be monitored.'
)

$ErrorActionPreference = 'Stop'

function Set-Reg([string]$Path, [string]$Name, $Value, [string]$Type = 'DWord') {
    if (-not (Test-Path $Path)) { New-Item -Path $Path -Force | Out-Null }
    New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force | Out-Null
}

function Get-Reg([string]$Path, [string]$Name) {
    try { (Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction Stop).$Name } catch { $null }
}

function Invoke-Native([string]$File, [string[]]$Arguments) {
    $out = & $File @Arguments 2>&1
    if ($LASTEXITCODE) { throw "$File $($Arguments -join ' ') failed (exit $LASTEXITCODE): $out" }
}

function Test-DefenderActive {
    try { (Get-MpComputerStatus -ErrorAction Stop).AMRunningMode -eq 'Normal' } catch { $false }
}

$PolicySystem = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
$NotDefender = { if (-not (Test-DefenderActive)) { 'Microsoft Defender is not the active antivirus.' } }

# One entry per check. Skip returns a reason when the fix doesn't apply to this device.
# OptIn fixes run only with -IncludeOptIn. Restart marks fixes that take effect after a restart.
$Fixes = [ordered]@{
    'AV-001' = @{
        Title = 'Turn on Microsoft Defender real-time protection'
        Skip  = $NotDefender
        Do    = { Set-MpPreference -DisableRealtimeMonitoring $false }
    }
    'AV-002' = @{
        Title = 'Update Microsoft Defender signatures'
        Skip  = $NotDefender
        Do    = { Update-MpSignature }
    }
    'AV-004' = @{
        Title = 'Block with 6 low-impact attack surface reduction rules (LSASS credential theft, vulnerable drivers, WMI persistence, executables from email, Office creating executables or injecting code)'
        OptIn = $true
        Skip  = $NotDefender
        Do    = {
            $ids = '9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2', '56a863a9-875e-4185-98a7-b882c64b5ce5', 'e6db77e5-3df2-4cf1-b95a-636979351e5b',
                   'be9ba2d9-53ea-4cdc-84e5-9b1eeee46550', '3b576869-a4ec-4529-8536-b80a7769e899', '75668c1f-73b5-4cf0-bb93-3ecf5cb7cc84'
            Add-MpPreference -AttackSurfaceReductionRules_Ids $ids -AttackSurfaceReductionRules_Actions (@('Enabled') * $ids.Count)
        }
    }
    'AV-005' = @{
        Title = 'Schedule a daily Defender quick scan at 12:00 and start one now'
        Skip  = $NotDefender
        Do    = {
            Set-MpPreference -ScanScheduleQuickScanTime 12:00:00
            Start-Process (Join-Path $env:ProgramFiles 'Windows Defender\MpCmdRun.exe') -ArgumentList '-Scan', '-ScanType', '1' -WindowStyle Hidden
        }
    }
    'FW-001' = @{
        Title = 'Turn on Windows Firewall for all profiles and block unsolicited inbound connections'
        Do    = { Set-NetFirewallProfile -Profile Domain, Private, Public -Enabled True -DefaultInboundAction Block }
    }
    'ACC-002' = @{
        Title = 'Disable the Guest account'
        Do    = { Get-LocalUser | Where-Object { "$($_.SID)" -like '*-501' } | Disable-LocalUser }
    }
    'ACC-003' = @{
        Title = 'Disable the built-in Administrator account'
        Skip  = {
            if ((Get-Reg 'HKLM:\SOFTWARE\Microsoft\Policies\LAPS' 'BackupDirectory') -or (Get-Reg 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS' 'BackupDirectory') -or
                (Get-Reg 'HKLM:\SOFTWARE\Policies\Microsoft Services\AdmPwd' 'AdmPwdEnabled') -eq 1) { return 'LAPS is configured and may manage this account.' }
            $grp = ([Security.Principal.SecurityIdentifier]'S-1-5-32-544').Translate([Security.Principal.NTAccount]).Value.Split('\')[-1]
            $others = @(([ADSI]"WinNT://./$grp,group").psbase.Invoke('Members') | ForEach-Object {
                $sid = New-Object Security.Principal.SecurityIdentifier($_.GetType().InvokeMember('objectSid', 'GetProperty', $null, $_, $null), 0)
                if ($sid.Value -match '-500$') { return }
                $local = Get-LocalUser -SID $sid -ErrorAction SilentlyContinue
                if (-not $local -or $local.Enabled) { $sid }
            })
            if (-not $others) { 'No other enabled administrator. Add one first so you are not locked out.' }
        }
        Do    = { Get-LocalUser | Where-Object { "$($_.SID)" -like '*-500' } | Disable-LocalUser }
    }
    'ACC-004' = @{
        Title = "Lock accounts for $LockoutMinutes minutes after 10 wrong passwords"
        Do    = {
            Invoke-Native net.exe 'accounts', '/lockoutthreshold:10'
            Invoke-Native net.exe 'accounts', "/lockoutduration:$LockoutMinutes", "/lockoutwindow:$LockoutMinutes"
        }
    }
    'ACC-005' = @{
        Title = 'Require passwords of at least 14 characters for local accounts (applies at the next password change)'
        Do    = { Invoke-Native net.exe 'accounts', '/minpwlen:14' }
    }
    'ACC-006' = @{
        Title = 'Require complex passwords for local accounts'
        Do    = {
            $inf = Join-Path $env:TEMP 'trimtab-secpol.inf'; $sdb = Join-Path $env:TEMP 'trimtab-secpol.sdb'
            try {
                Invoke-Native secedit.exe '/export', '/cfg', $inf, '/areas', 'SECURITYPOLICY', '/quiet'
                (Get-Content $inf) -replace '^\s*PasswordComplexity\s*=.*$', 'PasswordComplexity = 1' | Set-Content $inf -Encoding Unicode
                Invoke-Native secedit.exe '/configure', '/db', $sdb, '/cfg', $inf, '/areas', 'SECURITYPOLICY', '/quiet'
            } finally { Remove-Item $inf, $sdb, ([IO.Path]::ChangeExtension($sdb, 'jfm')) -ErrorAction SilentlyContinue }
        }
    }
    'ACC-007' = @{
        Title = 'Remember the last 24 passwords for local accounts'
        Do    = { Invoke-Native net.exe 'accounts', '/uniquepw:24' }
    }
    'ACC-009' = @{
        Title = 'Turn on User Account Control with prompts for administrators'
        Restart = $true
        Do    = {
            Set-Reg $PolicySystem 'EnableLUA' 1
            if ((Get-Reg $PolicySystem 'ConsentPromptBehaviorAdmin') -eq 0) { Set-Reg $PolicySystem 'ConsentPromptBehaviorAdmin' 5 }
        }
    }
    'SES-001' = @{
        Title = 'Lock the screen after 15 minutes of inactivity'
        Restart = $true
        Do    = { Set-Reg $PolicySystem 'InactivityTimeoutSecs' 900 }
    }
    'SES-002' = @{
        Title = 'Show a logon banner (set the wording with -BannerTitle and -BannerText)'
        OptIn = $true
        Do    = { Set-Reg $PolicySystem 'LegalNoticeCaption' $BannerTitle 'String'; Set-Reg $PolicySystem 'LegalNoticeText' $BannerText 'String' }
    }
    'SES-003' = @{
        Title = 'Require Network Level Authentication for Remote Desktop'
        Skip  = {
            $deny = Get-Reg 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' 'fDenyTSConnections'
            if ($null -eq $deny) { $deny = Get-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' 'fDenyTSConnections' }
            if ($deny -ne 0) { 'Remote Desktop is off.' }
        }
        Do    = {
            Set-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' 'UserAuthentication' 1
            $pol = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
            if ($null -ne (Get-Reg $pol 'UserAuthentication')) { Set-Reg $pol 'UserAuthentication' 1 }
        }
    }
    'HRD-001' = @{
        Title = 'Turn off SMBv1 (check first that no old printer, scanner, or NAS needs it)'
        Restart = $true
        Do    = {
            Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
            $f = Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -ErrorAction SilentlyContinue
            if ($f -and "$($f.State)" -eq 'Enabled') { Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart | Out-Null }
        }
    }
    'HRD-002' = @{
        Title = 'Turn off LLMNR name resolution'
        Do    = { Set-Reg 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient' 'EnableMulticast' 0 }
    }
    'HRD-003' = @{
        Title = 'Turn off NetBIOS over TCP/IP on every network adapter (older file shares and printers may rely on it)'
        OptIn = $true
        Do    = { Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces' | ForEach-Object { Set-Reg $_.PSPath 'NetbiosOptions' 2 } }
    }
    'HRD-004' = @{
        Title = 'Turn off AutoRun for all drives'
        Do    = { Set-Reg 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' 'NoDriveTypeAutoRun' 255 }
    }
    'HRD-005' = @{
        Title = 'Block writing to USB drives and other removable disks (reading still works)'
        OptIn = $true
        Do    = { Set-Reg 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices\{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}' 'Deny_Write' 1 }
    }
    'HRD-006' = @{
        Title = 'Turn on FIPS-compliant algorithms (some older apps and protocols stop working)'
        OptIn = $true
        Restart = $true
        Do    = { Set-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy' 'Enabled' 1 }
    }
    'HRD-007' = @{
        Title = 'Run LSA as a protected process (unsigned smart card or password plug-ins stop loading)'
        OptIn = $true
        Restart = $true
        Do    = { Set-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa' 'RunAsPPL' 1 }
    }
    'HRD-009' = @{
        Title = 'Stop WDigest from keeping plaintext passwords in memory'
        Do    = { Set-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' 'UseLogonCredential' 0 }
    }
    'HRD-010' = @{
        Title = 'Turn off SSL 2.0, SSL 3.0, TLS 1.0, and TLS 1.1 (old devices and apps may stop connecting)'
        OptIn = $true
        Restart = $true
        Do    = {
            foreach ($p in 'SSL 2.0', 'SSL 3.0', 'TLS 1.0', 'TLS 1.1') {
                foreach ($r in 'Server', 'Client') {
                    $k = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$p\$r"
                    Set-Reg $k 'Enabled' 0; Set-Reg $k 'DisabledByDefault' 1
                }
            }
        }
    }
    'AUD-001' = @{
        Title = 'Audit sign-ins, account changes, process creation, policy changes, and privilege use'
        Do    = {
            # Subcategory GUIDs work in every Windows display language.
            $need = [ordered]@{
                '{0CCE923F-69AE-11D9-BED3-505054503030}' = 'SF'   # Credential Validation
                '{0CCE9215-69AE-11D9-BED3-505054503030}' = 'SF'   # Logon
                '{0CCE9217-69AE-11D9-BED3-505054503030}' = 'F'    # Account Lockout
                '{0CCE9235-69AE-11D9-BED3-505054503030}' = 'SF'   # User Account Management
                '{0CCE9237-69AE-11D9-BED3-505054503030}' = 'S'    # Security Group Management
                '{0CCE922B-69AE-11D9-BED3-505054503030}' = 'S'    # Process Creation
                '{0CCE922F-69AE-11D9-BED3-505054503030}' = 'S'    # Audit Policy Change
                '{0CCE9228-69AE-11D9-BED3-505054503030}' = 'SF'   # Sensitive Privilege Use
            }
            Set-Reg 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa' 'SCENoApplyLegacyAuditPolicy' 1
            foreach ($guid in $need.Keys) {
                $a = @('/set', "/subcategory:$guid")
                if ($need[$guid] -match 'S') { $a += '/success:enable' }
                if ($need[$guid] -match 'F') { $a += '/failure:enable' }
                Invoke-Native auditpol.exe $a
            }
        }
    }
    'AUD-002' = @{
        Title = 'Grow the Security event log to 192 MB'
        Do    = { if ((Get-WinEvent -ListLog Security).MaximumSizeInBytes -lt 201326592) { Invoke-Native wevtutil.exe 'sl', 'Security', '/ms:201326592' } }
    }
    'AUD-003' = @{
        Title = 'Turn on PowerShell script block logging'
        Do    = { Set-Reg 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' 'EnableScriptBlockLogging' 1 }
    }
    'AUD-004' = @{
        Title = 'Include the command line in process creation events'
        Do    = { Set-Reg "$PolicySystem\Audit" 'ProcessCreationIncludeCmdLine_Enabled' 1 }
    }
    'AUD-005' = @{
        Title = 'Start the Windows Time service and start it automatically'
        Do    = { Set-Service W32Time -StartupType Automatic; Start-Service W32Time }
    }
    'PAT-004' = @{
        Title = 'Let Windows Update install automatically (removes notify-only and off policies; skip this if an RMM patches on purpose)'
        OptIn = $true
        Do    = {
            if ((Get-Service wuauserv).StartType -eq 'Disabled') { Set-Service wuauserv -StartupType Manual }
            $au = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
            if ((Get-Reg $au 'AUOptions') -eq 2) { Remove-ItemProperty $au -Name AUOptions }
            if ((Get-Reg $au 'NoAutoUpdate') -eq 1) { Remove-ItemProperty $au -Name NoAutoUpdate }
        }
    }
}

# Checks that need a person, with the reason.
$Manual = [ordered]@{
    'ENC-001' = 'BitLocker or Device encryption needs a recovery key saved somewhere safe first.'
    'ENC-002' = 'The TPM is turned on in the firmware setup.'
    'ENC-003' = 'Secure Boot is turned on in the firmware setup.'
    'AV-003'  = 'Tamper protection is turned on in Windows Security or the Defender portal; scripts cannot change it.'
    'ACC-001' = 'Removing admin rights needs a person to confirm another admin account works.'
    'ACC-008' = 'LAPS needs Intune or Active Directory (and Windows Pro or higher).'
    'HRD-008' = 'Credential Guard needs Windows Enterprise or Education and firmware support.'
    'PAT-001' = 'Install updates with Windows Update or your patch tool.'
    'PAT-002' = 'Restart the device.'
    'PAT-003' = 'Upgrade to a supported Windows release.'
    'MGT-001' = 'Enroll the device in Intune or join it to a domain.'
}

$elevated = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if ($Apply -and -not $elevated) { throw 'Run this script elevated (or as SYSTEM) to apply fixes.' }

$ids = if ($Checks) { @($Checks -split ',' | ForEach-Object { $_.Trim().ToUpper() } | Where-Object { $_ }) } else { @($Fixes.Keys) }
$mode = if ($Apply) { 'Applying' } else { 'Preview (nothing is changed; add -Apply to make these changes)' }
Write-Host "Trimtab fix script on $env:COMPUTERNAME. $mode"
Write-Host ''

$applied = 0; $failed = 0; $restart = $false
foreach ($id in $ids) {
    $fix = $Fixes[$id]
    if (-not $fix) {
        $why = if ($Manual.Contains($id)) { $Manual[$id] } else { 'No automated fix.' }
        Write-Host ("{0,-8} Manual    {1}" -f $id, $why) -ForegroundColor DarkGray
        continue
    }
    if ($fix.OptIn -and -not $IncludeOptIn) {
        Write-Host ("{0,-8} Opt-in    {1}. Add -IncludeOptIn to apply." -f $id, $fix.Title) -ForegroundColor DarkGray
        continue
    }
    try {
        $skip = if ($fix.Skip) { & $fix.Skip }
        if ($skip) { Write-Host ("{0,-8} Skipped   {1}" -f $id, $skip) -ForegroundColor DarkGray; continue }
        if (-not $Apply) { Write-Host ("{0,-8} Would     {1}" -f $id, $fix.Title); continue }
        & $fix.Do
        $applied++
        if ($fix.Restart) { $restart = $true }
        Write-Host ("{0,-8} Done      {1}" -f $id, $fix.Title) -ForegroundColor Green
    } catch {
        $failed++
        Write-Host ("{0,-8} Failed    {1}: {2}" -f $id, $fix.Title, $_.Exception.Message) -ForegroundColor Red
    }
}

Write-Host ''
if ($Apply) {
    Write-Host "$applied applied, $failed failed."
    if ($restart) { Write-Host 'Restart the device to finish some of these changes.' -ForegroundColor Yellow }
    if (Get-ScheduledTask -TaskName 'Trimtab Lookout Scan' -ErrorAction SilentlyContinue) {
        Start-ScheduledTask -TaskName 'Trimtab Lookout Scan'
        Write-Host 'Started a Trimtab Lookout scan; the Bridge shows the results in a few minutes.'
    }
    if ($failed) { exit 1 }
}

Hand us the helm

Hand us the helm is coming soon. Trimtab will apply selected fixes for you, with your approval, an audit trail, and an automatic rescan to confirm the fix worked. Until then, Lookout and the Microsoft 365 connection remain strictly read-only.

What to fix first

  1. High severity findings, especially those marked Drifted
  2. Checks failing on many devices (see Checks), because one policy often fixes all of them
  3. Medium and Low severity findings