This topic contains 2 replies, has 3 voices, and was last updated by
December 28, 2016 at 11:08 pm #60928ParticipantPoints: 0Rank: Member
Hi. I am totally new to powershell, just starting to learn it. I'm trying to deploy Java through SCCM 2012. I want to create a script that will check if IE is running on a pc, & if so, display a message that IE will be shutdown in a given amount of time in order for the Java install to complete. After doing some searching I found a script that looks like it will do what I need it to however it gives errors when I run it saying there are syntax errors. If anyone could assist with getting this working below it would be greatly appreciated.
Set oShell = WScript.CreateObject("WScript.Shell")
Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")
For Each objProcess in colProcessList ' Loop checks all running processes and sets vFound to True if it finds iexplore.EXE running.
If objProcess.name = "iexplore.exe" then
vFound = True
If vFound = True then
oShell.Popup "Closing IE" & vbCrLf & vbCrLf & "Click OK if you are ready to continue now.",30,"Software Update"
oShell.Run "taskkill /F /IM iexplore.exe", 1, True
December 28, 2016 at 11:25 pm #60931ParticipantPoints: 642Rank: Major Contributor
Sorry. That's not Powershell – it is VBScript.
Anyway when you post code in a forum you should format it as code. And when you have errors you should post the errors as well.
December 29, 2016 at 9:02 am #60936ModeratorPoints: 24Rank: Member
Olaf is correct the script you've posted is VBScript not PowerShell. I can highly recommended to watch the Getting Started with PowerShell series on Channel 9: https://channel9.msdn.com/Series/GetStartedPowerShell3
However, checkout the examples of the PowerShell cmdlets Get-Process and Stop-Process on the following pages:
You can re-create the popup with below lines of PowerShell:
$shell = New-Object -ComObject WScript.Shell $shell.Popup("Closing IE`r`rClick OK if you are ready to continue now.", 30, 'Software Update')
I hope that helps. Otherwise Bing and Google are your friend too.
The topic ‘Closing iexplore.exe’ is closed to new replies.