Advertisement
Guest User

Untitled

a guest
Jun 10th, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. $path1 = "$env:LOCALAPPDATA\Kingsoft\WPS Office"
  2. $path2 = "C:\Kingsoft\WPS Office"
  3.  
  4. md "$path1" -Force | Out-Null
  5. md "$path2" -Force | Out-Null
  6.  
  7. $denyRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
  8. "Everyone",
  9. "FullControl",
  10. "ContainerInherit,ObjectInherit",
  11. "None",
  12. "Deny"
  13. )
  14.  
  15. foreach ($folder in @($path1, $path2)) {
  16. $acl = Get-Acl $folder
  17. $acl.AddAccessRule($denyRule)
  18. Set-Acl -Path $folder -AclObject $acl
  19. Write-Host "Access restricted to $folder"
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement