forked from ChrisTitusTech/winutil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the razer block by chris titus under the Fixes Section
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function Invoke-WPFRazerBlock { | ||
<# | ||
.SYNOPSIS | ||
Blocks razer software automatic install. | ||
.DESCRIPTION | ||
It disables the automatic driver installation and denies write permission to razer installation to prevent the autoinstall. | ||
#> | ||
$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 | ||
} |