📜 VBScript (WSH)

Check "Disable Autoplay for All Drives" Status (VBScript)

Reads the registry value behind the "Disable Autoplay for All Drives" tweak to confirm whether it's applied.

By WindowsScripting.com · 739 B
CheckDisableAutoplayAllDrivesStatus.vbs
' ============================================================
' CheckDisableAutoplayAllDrivesStatus.vbs
'
' Checks whether "Disable Autoplay for All Drives" is currently applied.
'
' Usage: cscript CheckDisableAutoplayAllDrivesStatus.vbs
' ============================================================

Option Explicit

Dim objShell, currentValue
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next
currentValue = objShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun")

If Err.Number <> 0 Then
    WScript.Echo "'NoDriveTypeAutoRun' is not set (using the Windows default)."
Else
    WScript.Echo "Current value of 'NoDriveTypeAutoRun': " & currentValue
End If
On Error Goto 0