Advertisement
Guest User

Untitled

a guest
Apr 11th, 2014
2,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <# Filename: Remove_Chrome.ps1
  2.    
  3.    Description: Removes file traces of Google Chrome from all user profiles directories
  4.    and currently logged on user registry keys. There are no input or output parameters,
  5.    but if you want to do a dry run you can add -whatif at the end of each Remove-Item command.    
  6.    
  7.    Purpose: When Chrome for Business was rolled out not all traces of user installed Chrome was removed. In order to get rid
  8.    of reported security vulnerabilities there is a need to manually remove these files/keys.
  9. #>
  10. # Set the root directory where User Chrome is installed. (If running on XP you will need to change this)
  11. $RootDirectory= "C:\Users\*\AppData\Local\Google\Chrome\Application\*"
  12.  
  13. #Check for HKey Users registry drive. Create if needed
  14. #if(!(Get-PSDrive -name HKU)){
  15.     New-PSDrive HKU Registry HKEY_USERS
  16. #}
  17. # Set Registry paths for user installed chrome. (Users who are not logged on will not be checked)
  18. $ChomeAddRemoveKey="HKU:\S-1-5-21*\Software\Microsoft\Windows\CurrentVersion\Uninstall"
  19. $ChromeKey= "HKU:\S-1-5-21*\Software\Google\Update"
  20.  
  21. # Delete all files under Chrome's user install directory
  22. Remove-Item -recurse -force $RootDirectory
  23. # Find and remove all user specific chrome installs from the registry.
  24. Get-ChildItem $ChromeAddRemoveKey -ErrorAction SilentlyContinue | Where-Object {($_.PSChildName -eq 'Google Chrome') -or ($_.PSChildName -eq 'Chrome')} | Remove-Item -force
  25. Get-ChildItem $ChromeKey -ErrorAction SilentlyContinue -recurse | Where-Object {($_.PSChildName -eq '{8A69D345-D564-463c-AFF1-A69D9E530F96}') -or
  26.     ($_.PSChildName -eq '{00058422-BABE-4310-9B8B-B8DEB5D0B68A}')} | Remove-Item -force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement