Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Set Files to be deleted
- $FileToDelete1 = "C:\Users\$userName\AppData\Local\Temp\dbutil_2_3.sys"
- $FileToDelete2 = "C:\Windows\Temp\dbutil_2_3.sys"
- #Find all the user profiles in the registry
- $users = Get-ChildItem "C:\Users"
- #Loop through each profile and delete driver
- foreach($user in $users)
- {
- $userName = $user.Name
- if (Test-Path $FileToDelete1) {
- "file found in $users folder and deleted" | Out-File -FilePath C:\DellResult.txt
- Remove-Item $FileToDelete1 -Force
- }
- else {
- "file not found in user folders" | Out-File -FilePath C:\DellResult.txt
- }
- }
- #Delete from Windows\Temp
- if (Test-Path $FileToDelete2) {
- "file found in Windows\Temp and deleted" | Out-File -FilePath C:\DellResult.txt
- Remove-Item $FileToDelete2 -Force
- }
- else {
- "file not found in Windows\Temp" | Out-File -FilePath C:\DellResult.txt
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement