35 lines
1.4 KiB
PowerShell
35 lines
1.4 KiB
PowerShell
#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"
|
|
} |