Complete a task - Exit Compiled App

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
plautodfl
Posts: 15
Joined: Tue Apr 16, 2019 8:16 pm

Complete a task - Exit Compiled App

Post by plautodfl » Thu Jul 11, 2019 12:30 pm

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.165
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17763.0

I have a little snippet that checks to see if a server is online - if so launches iexplore and the site.
However, once the site is successfully launched (it runs through four sites)
I would like it to close the Powershell Studio App automatically.
Thoughts?
Thanks!
~P.

Code: Select all


if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr01" -Count 1){
$url = "http://dcx-p-a-xxxdr01/Director"
$ie = New-Object -com internetexplorer.application
$ie.visible = $true
$ie.navigate($url)
break
}

if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr02" -Count 1){
$url = "http://dcx-p-a-ctxdrxx/Director"
$ie = New-Object -com internetexplorer.application
$ie.visible = $true
$ie.navigate($url)
break
}



User avatar
brittneyr
Site Admin
Posts: 77
Joined: Thu Jun 01, 2017 7:20 am

Re: Complete a task - Exit Compiled App

Post by brittneyr » Thu Jul 11, 2019 3:09 pm

Are you running this script through PowerShell Studio and when its done you would like PowerShell Studio to close?

If you are running this script from PowerShell Studio, I would suggest using the packager to package the script into an exe that you can run without using PowerShell Studio.
You can use the cmdlets get-process and stop-process to close PowerShell Studio.
Brittney Ryn
SAPIEN Technologies, Inc.