Advertisement
Guest User

Dell DSA-2021-088

a guest
May 5th, 2021
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Set Files to be deleted
  2. $FileToDelete1 = "C:\Users\$userName\AppData\Local\Temp\dbutil_2_3.sys"
  3. $FileToDelete2 = "C:\Windows\Temp\dbutil_2_3.sys"
  4. #Find all the user profiles in the registry
  5. $users = Get-ChildItem "C:\Users"
  6. #Loop through each profile and delete driver
  7. foreach($user in $users)
  8. {
  9.     $userName = $user.Name
  10.     if (Test-Path $FileToDelete1) {
  11.     "file found in $users folder and deleted" | Out-File -FilePath C:\DellResult.txt
  12.     Remove-Item $FileToDelete1 -Force
  13.     }
  14.     else {
  15.     "file not found in user folders" | Out-File -FilePath C:\DellResult.txt
  16.     }
  17. }
  18. #Delete from Windows\Temp
  19. if (Test-Path $FileToDelete2) {
  20.     "file found in Windows\Temp and deleted" | Out-File -FilePath C:\DellResult.txt
  21.     Remove-Item $FileToDelete2 -Force
  22.     }
  23.      else {
  24.     "file not found in Windows\Temp" | Out-File -FilePath C:\DellResult.txt
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement