Page 1 of 1

Complete a task - Exit Compiled App

Posted: Thu Jul 11, 2019 12:30 pm
by plautodfl
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.

  1.  
  2.  
  3.  if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr01" -Count 1){
  4.  
  5.         $url = "http://dcx-p-a-xxxdr01/Director"
  6.  
  7.         $ie = New-Object -com internetexplorer.application
  8.  
  9.         $ie.visible = $true
  10.  
  11.         $ie.navigate($url)
  12.  
  13.         break
  14.  
  15.     }
  16.  
  17.  
  18.  
  19.     if(Test-Connection -Quiet -ComputerName "dcx-p-a-xxxdr02" -Count 1){
  20.  
  21.         $url = "http://dcx-p-a-ctxdrxx/Director"
  22.  
  23.         $ie = New-Object -com internetexplorer.application
  24.  
  25.         $ie.visible = $true
  26.  
  27.         $ie.navigate($url)
  28.  
  29.         break
  30.  
  31.     }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  

Re: Complete a task - Exit Compiled App

Posted: Thu Jul 11, 2019 3:09 pm
by brittneyr
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.

Re: Complete a task - Exit Compiled App

Posted: Wed Jul 17, 2019 9:35 am
by plautodfl
This is a compiled app using PowerShell studio for our help desk.
The app scrolls through some web servers.
When it hits a web server that is up, it launches the web site in a browser.
After the web site is launched -
I would then like the PowerShell compiled exe to close automatically without having to click File | Exit
Thanks!
~P.

Re: Complete a task - Exit Compiled App

Posted: Wed Jul 17, 2019 10:37 am
by brittneyr
How are you packaging your exe?
If you do not have any written output, I would suggest packaging your script with a Silent engine:
sps-silent.png
sps-silent.png (72.61 KiB) Viewed 1700 times
This script engine option will suppress any output sent to the console, and no window is displayed when executed directly.

Re: Complete a task - Exit Compiled App

Posted: Fri Jul 19, 2019 8:10 am
by plautodfl
coolio-
Trying now...
Thanks!
~P.