Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Last active October 2, 2019 11:26
Show Gist options
  • Save KINGSABRI/70c304e55a588c556b373e4c7a1e32d5 to your computer and use it in GitHub Desktop.
Save KINGSABRI/70c304e55a588c556b373e4c7a1e32d5 to your computer and use it in GitHub Desktop.
PowerShell Disable Windows10 Auto update and Security
Clear-Host
Write-Host "1 -> Never check for updates"
Write-Host "2 -> Disable Windiws Firewall"
Write-Host "3 -> Disable Windiws Defender"
Write-Host "Enter any character to exit"
Write-Host
switch(Read-Host "Choose Window Update Settings"){
1 {$UpdateValue = 1}
2 {$UpdateValue = 2}
2 {$UpdateValue = 3}
Default{Exit}
}
$WindowsUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\"
$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
If(Test-Path -Path $WindowsUpdatePath) {
Remove-Item -Path $WindowsUpdatePath -Recurse
}
If ($UpdateValue -eq 1) {
Write-Host "[+] Disable AutoUpdate:"
Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1
Write-Host "[+] Disabel Windows update ScheduledTask"
Get-ScheduledTask -TaskPath "\Microsoft\Windows\WindowsUpdate\" | Disable-ScheduledTask
Write-Host "[+] Take Windows update Orchestrator ownership"
takeown /F C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /A /R
icacls C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /grant Administrators:F /T
Write-Host "[+] List Windows update Orchestrator ownership"
Get-ScheduledTask -TaskPath "\Microsoft\Windows\UpdateOrchestrator\" | Disable-ScheduledTask
Write-Host "[+] Disable Windows Update Server AutoStartup"
Set-Service wuauserv -StartupType Disabled
sc.exe config wuauserv start=disabled
Write-Host "[+] Disable Windows Update Running Service"
Stop-Service wuauserv
sc.exe stop wuauserv
Write-Host "[+] Check Windows Update Service state"
sc.exe query wuauserv | findstr "STATE"
}
If ($UpdateValue -eq 2) {
netsh advfirewall set allprofiles state off
}
If ($UpdateValue -eq 3){
Set-MpPreference -DisableRealtimeMonitoring $true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment