⚡ PowerShell 5.1+

Check "Disable Autoplay for All Drives" Status

Reads the current registry value behind the "Disable Autoplay for All Drives" tweak so you can confirm whether it's applied.

By WindowsScripting.com · 826 B
Test-DisableAutoplayAllDrivesStatus.ps1
<#
.SYNOPSIS
    Checks whether "Disable Autoplay for All Drives" is currently applied.

.DESCRIPTION
    Reads HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer \ NoDriveTypeAutoRun and reports its current value,
    or reports that it isn't set (falling back to the Windows default).

.EXAMPLE
    .\Test-DisableAutoplayAllDrivesStatus.ps1
#>

[CmdletBinding()]
param()

$regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'

$value = Get-ItemProperty -Path $regPath -Name 'NoDriveTypeAutoRun' -ErrorAction SilentlyContinue

if ($null -eq $value) {
    Write-Host "'NoDriveTypeAutoRun' is not set at $regPath (using the Windows default)." -ForegroundColor Yellow
} else {
    Write-Host "Current value of 'NoDriveTypeAutoRun': $($value.'NoDriveTypeAutoRun')" -ForegroundColor Green
}