Add Fix Scripts/Fix - Remove printer driver.ps1

This commit is contained in:
Gabe committed 2026-11-23 23:20:13 +00:00
1 parent ac3c961785
commit e61453957d
1 file changed
+35
@@ -0,0 +1,35 @@
#File path of the driver
$FileName = "C:\Windows\System32\DriverStore\FileRepository\hpcu250u.inf_amd64_82bdf715913ee606"
$FileName2 = "C:\Windows\System32\DriverStore\FileRepository\hpcu255u.inf_amd64_883dd40f467c5d42"
#Check if the file exists
$testpath = Test-Path $FileName
$testpath2 = Test-Path $FileName2
#If definition file exists, delete it
if ($testpath -eq "True") {
#$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("ANB\UFS-ITS","FullControl","ObjectInherit,ContainerInherit","None","Allow")
#$Acl.SetAccessRule($Ar)
##$acl.SetOwner([System.Security.Principal.NTAccount]"ANB\UFS-ITS")
#Set-Acl -Path $FileName -AclObject $Acl
Remove-Item $FileName -Force -Recurse
write-host "$FileName has been deleted"
}
#If definition file doesnt exist, dont do anything
else {
Write-host "$FileName doesn't exist"
}
#If definition file exists, delete it
if ($testpath2 -eq "True") {
#$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("ANB\UFS-ITS","FullControl","ObjectInherit,ContainerInherit","None","Allow")
#$Acl.SetAccessRule($Ar)
##$acl.SetOwner([System.Security.Principal.NTAccount]"ANB\UFS-ITS")
#Set-Acl -Path $FileName -AclObject $Acl
Remove-Item $FileName2 -Force -Recurse
write-host "$FileName2 has been deleted"
}
#If definition file doesnt exist, dont do anything
else {
Write-host "$FileName2 doesn't exist"
}