SHARE
TWEET

Untitled

a guest Jun 9th, 2014 1,817 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ErrorActionPreference="silentlycontinue"
  2. $rule = New-Object System.Security.AccessControl.RegistryAccessRule (([System.Security.Principal.SecurityIdentifier]("S-1-1-0")).Translate([System.Security.Principal.NTAccount]).Value,"SetValue, CreateSubKey","Deny")
  3. $keys = @(
  4. "HKCU:\Software\Microsoft\Windows\Shell\Bags",
  5. "HKCU:\Software\Microsoft\Windows\Shell\BagMRU",
  6. "HKCU:\Software\Microsoft\Windows\ShellNoRoam\Bags",
  7. "HKCU:\Software\Microsoft\Windows\ShellNoRoam\BagMRU",
  8. "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags",
  9. "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU",
  10. "HKCU:\Software\Classes\Wow6432Node\Local Settings\Software\Microsoft\Windows\Shell\Bags",
  11. "HKCU:\Software\Classes\Wow6432Node\Local Settings\Software\Microsoft\Windows\Shell\BagMRU",
  12. "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache",
  13. "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\CIDSizeMRU",
  14. "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\FirstFolder",
  15. "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU",
  16. "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRULegacy",
  17. "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSavePidlMRU")
  18. foreach ($i in $keys)
  19. {
  20. Remove-Item -Path $i -Recurse -Force
  21. New-Item -Path $i -Force
  22. $acl = Get-Acl $i
  23. $acl.SetAccessRule($rule)
  24. $acl | Set-Acl -Path $i
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top