Prevent access to drives from My Computer: registry value NoViewOnDriveUserHKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Policy ID
NoViewOnDrive
Scope
User Configuration
Supported on
At least Windows 2000
Source
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (version 1.0)
Category
Windows Components › File Explorer

Registry

NoViewOnDrive

REG_DWORDUser
Enabled value
Depends on the option value
Element
Pick one of the following combinations
Options
ItemStored value
Restrict A and B drives only3
Restrict C drive only4
Restrict D drive only8
Restrict A, B and C drives only7
Restrict A, B, C and D drives only15
Restrict all drives67108863
Do not restrict drives0
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]

; Options (use only one)
; Restrict A and B drives only
"NoViewOnDrive"=dword:00000003
; Restrict C drive only
"NoViewOnDrive"=dword:00000004
; Restrict D drive only
"NoViewOnDrive"=dword:00000008
; Restrict A, B and C drives only
"NoViewOnDrive"=dword:00000007
; Restrict A, B, C and D drives only
"NoViewOnDrive"=dword:0000000f
; Restrict all drives
"NoViewOnDrive"=dword:03ffffff
; Do not restrict drives
"NoViewOnDrive"=dword:00000000
CMD
:: Options (use only one)

:: Restrict A and B drives only
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 3 /f
:: Restrict C drive only
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 4 /f
:: Restrict D drive only
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 8 /f
:: Restrict A, B and C drives only
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 7 /f
:: Restrict A, B, C and D drives only
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 15 /f
:: Restrict all drives
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 67108863 /f
:: Do not restrict drives
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoViewOnDrive" /t REG_DWORD /d 0 /f
PowerShell
# Common: create the key
New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null

# Options (use only one)
# Restrict A and B drives only
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 3 -Force | Out-Null
# Restrict C drive only
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 4 -Force | Out-Null
# Restrict D drive only
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 8 -Force | Out-Null
# Restrict A, B and C drives only
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 7 -Force | Out-Null
# Restrict A, B, C and D drives only
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 15 -Force | Out-Null
# Restrict all drives
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 67108863 -Force | Out-Null
# Do not restrict drives
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoViewOnDrive' -PropertyType DWord -Value 0 -Force | Out-Null