-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrowserReset.ps1
More file actions
163 lines (105 loc) · 4.89 KB
/
BrowserReset.ps1
File metadata and controls
163 lines (105 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
$UserDataLocal = $env:LOCALAPPDATA
$UserDataRoaming = $env:APPDATA
$UserFolder = $env:USERPROFILE
$BrowserCleanLog = 'C:\Users\username\Desktop\BrowserCleanLog.txt'
$EDGERegKey = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge'
Write-Host
"Internet Explorer (1), EDGE (2), Firefox (3), Chrome (4), Exit (5)"
Write-Host " "
$BrowserClean = Read-Host -Prompt 'Please select the browser you would like to clean or select Option 5 to exit.'
do {
if ($BrowserClean -eq 1) {
Write-Host "Cleaning Internet Explorer..."
# Can be Uncommented to Backup User Data
#New-Item -Path "$UserFolder\Desktop" -Name "Browser_Archives" -ItemType "directory"
#$compress = @{
# Path = "$UserDataLocal\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
# CompressionLevel = "Fastest"
# DestinationPath = "$UserFolder\Desktop\Browser_Archives\EDGE-Browser-Backup.Zip"
#}
Write-Host "Deleting Temporary Internet Files"
Remove-Item -path "$UserDataLocal\Microsoft\Windows\Temporary Internet Files\*" -Recurse -Force -EA SilentlyContinue -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Start-Sleep -s 2
Write-Host "Deleting INetCache"
Remove-Item -path "$UserDataLocal\Microsoft\Windows\INetCache\*" -Recurse -Force -EA SilentlyContinue -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Start-Sleep -s 2
Write-Host "Reseting IE Files and Settings stored by Add-ons"
rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
Start-Sleep -s 10
Write-Host "Complete"
Write-Host
"Internet Explorer (1), EDGE (2), Firefox (3), Chrome (4), Exit (5)"
Write-Host " "
$BrowserClean = Read-Host -Prompt 'Please select the browser you would like to clean or select Option 5 to exit.'
}
Elseif ($BrowserClean -eq 2)
{
# Can be Uncommented to Backup User Data
#Stop-Service -Name "cryptsvc"
#New-Item -Path "$UserFolder\Desktop" -Name "Browser_Archives" -ItemType "directory"
#$compress = @{
# Path = "$UserDataLocal\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
# CompressionLevel = "Fastest"
# DestinationPath = "$UserFolder\Desktop\Browser_Archives\EDGE-Browser-Backup.Zip"
#}
#Compress-Archive @compress
Write-Host "Deleting Edge Package Files"
Remove-Item -Path "$UserDataLocal\Packages\Microsoft.MicrosoftEdge_*" -Recurse -Force -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Start-Sleep -s 2
Write-Host "Deleting EDGE Registry Key"
Remove-Item -Path "$EDGERegKey" -Recurse -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Start-Sleep -s 2
#Start-Service -Name "cryptsvc"
Write-Host "Reinstalling EDGE Browser"
Get-AppXPackage -AllUsers -Name Microsoft.MicrosoftEdge | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Start-Sleep -s 10
Write-Host "Reinstall Complete"
Write-Host
"Internet Explorer (1), EDGE (2), Firefox (3), Chrome (4), Exit (5)"
Write-Host " "
$BrowserClean = Read-Host -Prompt 'Please select the browser you would like to clean or select Option 5 to exit.'
}
Elseif ($BrowserClean -eq 3)
{
Write-Host "Deleting Firefox Profiles"
# Can be Uncommented to Backup User Data
#New-Item -Path "$UserFolder\Desktop" -Name "Browser_Archives" -ItemType "directory"
#$compress = @{
# Path = "$UserDataLocal\Mozilla\Firefox\Profiles\*"
# CompressionLevel = "Fastest"
# DestinationPath = "$UserFolder\Desktop\Browser_Archives\Firefox-Browser-Backup.Zip"
#}
#Compress-Archive @compress
Remove-Item -Path "$UserDataLocal\Mozilla\Firefox\Profiles\*" -Recurse -Force -EA SilentlyContinue -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Remove-Item -Path "$UserDataRoaming\Mozilla\Firefox\Profiles\*" -Recurse -Force -EA SilentlyContinue -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Write-Host
"Internet Explorer (1), EDGE (2), Firefox (3), Chrome (4), Exit (5)"
Write-Host " "
$BrowserClean = Read-Host -Prompt 'Please select the browser you would like to clean or select Option 5 to exit.'
}
Elseif ($BrowserClean -eq 4)
{
Write-Host "Deleting Chrome User Data.."
# Can be Uncommented to Backup User Data
#New-Item -Path "$UserFolder\Desktop" -Name "Browser_Archives" -ItemType "directory"
#$compress = @{
# Path = "$$UserDataLocal\Google\Chrome\User Data\Default\*"
# CompressionLevel = "Fastest"
# DestinationPath = "$UserFolder\Desktop\Browser_Archives\Chrome-Browser-Backup.Zip"
#}
#Compress-Archive @compress
Remove-Item -Path "$UserDataLocal\Google\Chrome\User Data\Default\*" -Recurse -Force -EA SilentlyContinue -Verbose 4>&1 | Out-File $BrowserCleanLog -Append
Write-Host
"Internet Explorer (1), EDGE (2), Firefox (3), Chrome (4), Exit (5)"
Write-Host " "
$BrowserClean = Read-Host -Prompt 'Please select the browser you would like to clean or select Option 5 to exit.'
}
Elseif ($BrowserClean -eq 5)
{
Write-Host "Exiting...."
Start-sleep -s 2
exit
}
} until ($BrowserClean -eq '5')
Write-Host "Exiting...."
Start-sleep -s 2