Skip to content

Instantly share code, notes, and snippets.

@notkearash
Created July 30, 2024 17:13
Show Gist options
  • Save notkearash/80099ad78e9e44788fb0b1818f80c483 to your computer and use it in GitHub Desktop.
Save notkearash/80099ad78e9e44788fb0b1818f80c483 to your computer and use it in GitHub Desktop.
CrowdWork - CrowdStrike Fix
$filePattern = "C:\Windows\System32\drivers\CrowdStrike\C-00000291*.sys"
function Boot-Into-SafeMode {
if ((Get-WmiObject -Class Win32_OperatingSystem).BootMode -eq 1) {
Write-Host "System is already in Safe Mode."
return
}
Write-Host "[!] Rebooting system into Safe Mode. Please wait..."
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SafeBoot\Option" -Name "OptionValue" -Value 1
Restart-Computer -Force
}
function Delete-Files {
param (
[string]$pattern
)
$files = Get-ChildItem -Path $pattern -ErrorAction SilentlyContinue
if ($files.Count -eq 0) {
Write-Host "[-] No files found matching pattern: $pattern"
return
}
foreach ($file in $files) {
Write-Host "[+] Deleting file: $($file.FullName)"
Remove-Item -Path $file.FullName -Force
}
}
Boot-Into-SafeMode
Start-Sleep -Seconds 60
Delete-Files -pattern $filePattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment