Created
June 7, 2013 12:28
-
-
Save chdanielmueller/5728892 to your computer and use it in GitHub Desktop.
Powershell Script referenced by http://behind-monitor.blogspot.com/ This Script resets the Internet Explorer settings to default values. It requires user interaction and requests the User to close all Internet Explorer windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This Script resets the Internet Explorer settings to default values | |
.DESCRIPTION | |
This Script resets the Internet Explorer settings to default values. | |
It requires user interaction and requests the User to close all Internet Explorer windows. | |
.NOTES | |
FileName : ResetIESettings.ps1 | |
Version : 1.0 | |
Author : Daniel Müller (chdanielmueller) | |
Last modified by : Daniel Müller (chdanielmueller) | |
.EXAMPLE | |
Psh> ResetIESettings.ps1 | |
#> | |
## Start Variables | |
# Default Variables | |
$arrProcs = "iexplore" | |
$continue = $false | |
## End Variables | |
## Start Script | |
Write-Host "Reset Internet Explorer settings" | |
# Load Assembly | |
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") | |
do { | |
# Check for an open Internet Explorer | |
$arrRunning = @() | |
foreach ($proc in $arrProcs) { | |
if(((get-process $proc -ea SilentlyContinue) -ne $Null)){ | |
$arrRunning += $proc | |
} | |
} | |
# Internet Explorer is running | |
if ($arrRunning.length -gt 0) { | |
$d = [System.Windows.Forms.MessageBox]::Show( | |
"There are currently one or more Internet Explorer windows open.`n`nYou must close all Internet Explorer windows before reset it to default.", | |
"Reset IE Settings to Default", | |
[System.Windows.Forms.MessageBoxButtons]::RetryCancel, | |
[System.Windows.Forms.MessageBoxIcon]::Warning | |
) | |
if ($d -eq [Windows.Forms.DialogResult]::Cancel) { | |
exit | |
} | |
# Internet Explorer is not running | |
} else { | |
$continue = $true | |
Write-Host "No IE processes are currently running" -foregroundcolor green | |
Write-Host "Please click on the `"Reset`" button" -foregroundcolor yellow | |
# Open reset settings window | |
& RunDll32.exe InetCpl.cpl,ResetIEtoDefaults | Out-Null | |
Write-Host "Resetting Done" -foregroundcolor green | |
} | |
} while ($continue -eq $false) | |
## End Script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment