-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.ps1
More file actions
14 lines (11 loc) 路 737 Bytes
/
Copy pathblock.ps1
File metadata and controls
14 lines (11 loc) 路 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$RazerPath = "C:\Windows\Installer\Razer"
# Disable driver auto-install via registry
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Device Installer" -Name "DisableCoInstallers" -Type DWord -Value 1
# Remove and lock install directory
Remove-Item $RazerPath -Recurse -Force
New-Item -Path "C:\Windows\Installer\" -Name "Razer" -ItemType "directory"
$Acl = Get-Acl $RazerPath
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\SYSTEM", "Write", "ContainerInherit,ObjectInherit", "None", "Deny")
$Acl.SetAccessRule($Ar)
Set-Acl $RazerPath $Acl