fleet/docs/solutions/scripts/windows-fleet-hardening.ps1
Harrison Ravazzolo 9e3cab666e
Update doc assets (#33740)
After talking with eng team and @nonpunctual, the /assets folder is
reserved for things inside the fleet app, so creating a new folder in
`/docs/solutions`

@AdamBaali - I updated your article paths and moved the assets to the
new folder, do you mind taking a peek and making sure it looks good?

Note: brock, we should also update handbook for new ritual to add
articles with assets like this.

---------

Co-authored-by: Brock Walters <153771548+nonpunctual@users.noreply.github.com>
2025-10-07 13:02:36 -06:00

27 lines
1.1 KiB
PowerShell

# Prevents uninstall/change of Fleet osquery via Windows UI.
# Sets NoRemove and NoModify = 1 under Fleet osquery uninstall entry.
# Hides uninstall/change options across Control Panel and Settings > Apps.
# Works on all Windows editions.
$UninstallPaths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
$FleetEntry = Get-ItemProperty -Path $UninstallPaths -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like "Fleet osquery*" }
if ($FleetEntry) {
Write-Output "[INFO] Fleet osquery found: $($FleetEntry.DisplayName)"
$RegKeyPath = $FleetEntry.PSPath
New-ItemProperty -Path $RegKeyPath -Name "NoRemove" -Value 1 -PropertyType DWord -Force | Out-Null
Write-Output "[SET] NoRemove = 1"
New-ItemProperty -Path $RegKeyPath -Name "NoModify" -Value 1 -PropertyType DWord -Force | Out-Null
Write-Output "[SET] NoModify = 1"
Write-Output "[DONE] Fleet osquery uninstall options hardened."
} else {
Write-Output "[WARN] Fleet osquery not found. Nothing changed."
}