After recently setting up some kiosks, I found I needed a script to allow users to close windows and tabs but still have Internet Explorer restart after the main window is closed. I use this script as a startup powershell script and it will check if Internet Explorer closed, and will restart the process if it closes. This is perfect for a kiosk machine that needs to be able to close tab's/other windows. It should also work with any other process.

 

 

PowerShell
Edit|Remove
$targetprocess = "iexplore" 
$process = Get-Process -Name $targetprocess 
 
while ($true){ 
    while (!($process)){ 
        $process = Get-Process -Name $targetprocess 
        if (!($process)){ 
            start-process $targetprocess 
        } 
        start-sleep -s 5 
    } 
    if ($process){ 
        $process.WaitForExit() 
        start-sleep -s 2 
        $process = Get-Process -Name $targetprocess 
        start-process $targetprocess 
    } 
}