# set recyclebin size to 100 MB for all drives and THIS logged on user ...

write-host '#######',(split-path $PSCommandPath -Leaf),'#######'

$drives=(Get-PSDrive).Name -match '^[a-z]$'

foreach ($Drive in $drives) {

  $Size=100

  $Volume=mountvol $Drive":\" /L
  $Guid=[regex]::Matches($Volume,'{([-0-9A-Fa-f].*?)}')
  $RegKey="HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\"+$Guid.value

  if (Test-Path $Regkey) {
    echo "INFO: setting recyclebin of drive [ $Drive ] to $Size MB"
    New-ItemProperty -Path $RegKey -Name MaxCapacity -Value $Size -PropertyType "dword" -Force | Out-Null
    New-ItemProperty -Path $RegKey -Name NukeOnDelete -Value 0 -PropertyType "dword" -Force | Out-Null
  }

}

write-host '#######',(split-path $PSCommandPath -Leaf),'#######'