Skip to content

Instantly share code, notes, and snippets.

@ii64
Last active July 31, 2025 22:03
Show Gist options
  • Select an option

  • Save ii64/bc8e845848a0e345fd3c9dab2c0fd1db to your computer and use it in GitHub Desktop.

Select an option

Save ii64/bc8e845848a0e345fd3c9dab2c0fd1db to your computer and use it in GitHub Desktop.
Enable Explorer Recycle Bin for Netowrk/Shared Folder
# Source: https://social.technet.microsoft.com/forums/windows/en-US/a349801f-398f-4139-8e8b-b0a92f599e2b/enable-recycle-bin-on-mapped-network-drives
# New-Item -Name "test" -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions"
$targGUID = "{" + [guid]::NewGUID().ToString().ToUpper() + "}"
echo "**Using GUID: $targGUID"
echo "** FOLDER DESCRIPTIONS"
$kPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions"
New-Item -Path $kPath -Type REG_SZ -Name $targGUID -Force
$kPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\$targGUID"
echo "RelativePath..."
$kName = "RelativePath"
$kValue = "Z:\\"
Get-Item -Path $kPath | New-ItemProperty -Name $kName -Value $kValue
echo "Category..."
$kName = "Category"
$kValue = 4
Get-Item -Path $kPath | New-ItemProperty -Name $kName -Value $kValue
echo "Name..."
$kName = "Name"
$kValue = "ZDriveWow"
Get-Item -Path $kPath | New-ItemProperty -Name $kName -Value $kValue
echo "** KNOWN FOLDER"
$kPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder"
New-Item -Path $kPath -Type REG_DWORD -Name $targGUID -Force
$kPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\$targGUID"
echo "MaxCapacity..."
$kName = "MaxCapacity"
$kValue = 511790
Get-Item -Path $kPath | New-ItemProperty -Name $kName -Value $kValue
echo "NukeOnDelete..."
$kName = "NukeOnDelete"
$kValue = 0
Get-Item -Path $kPath | New-ItemProperty -Name $kName -Value $kValue
echo "** DONE"
Start-Sleep -Seconds 60
@ii64

ii64 commented Apr 20, 2021

Copy link
Copy Markdown
Author

Read more about this on: Original Article

@nrothwell

Copy link
Copy Markdown

@ii64 does this still work

@CSGA-KPX

Copy link
Copy Markdown

@nrothwell Just confirmed, at least it works on Win 10. A reg file might be easier to understand than these scripts: copied from original article, replace with your own UUID.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"RelativePath"="X:\\"
"Category"=dword:00000004
"Name"="XDrive"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"MaxCapacity"=dword:0000c7eb
"NukeOnDelete"=dword:00000000

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