Skip to content

Instantly share code, notes, and snippets.

@heri16
Last active May 22, 2017 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heri16/b6a1243f7fdafb5672a02941da9a22af to your computer and use it in GitHub Desktop.
Save heri16/b6a1243f7fdafb5672a02941da9a22af to your computer and use it in GitHub Desktop.
Disable Autorun in Windows
# Disable Autoplay
Write-Host "***Disabling Autoplay...***"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1
# Disable Autorun for all drives
Write-Host "***Disabling Autorun for all drives...***"
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255
@heri16
Copy link
Author

heri16 commented May 22, 2017

iex (New-Object System.Net.Webclient).DownloadString("https://goo.gl/g3Q8hP")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment