login vsi company logo login vsi company logo 250x40

Start a PS1 script

  • Kaj
  • Kaj's Avatar Topic Author
29 Apr 2015 15:48 #2458 by Kaj

I need to start an application, that normally starts by follwoing a link in the start menu. That link start a ps1 script. But when I now try to open it with Login VSI, it open the ps1 file as a notepad file. How do I start it up with the powershell?
I tried VSI_ShellExecute and App_start.

Please Log in to join the conversation.

04 May 2015 20:52 #2463 by j.hsieh
Kajs question has been address via support email. For others who would like to know how to approach this issue, please read below.

Default PS1 opens up in notepad because this is a default windows action. Two work arounds is to change the object verb, or to start up PowerShell and point it to the PS1 script.

Ex: VSI_ShellExecute("logname"," C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe","-file c:\user\desktop\myscript.ps1").

Please Log in to join the conversation.

  • xen-rasmus
  • xen-rasmus's Avatar
10 May 2015 20:01 - 10 May 2015 20:01 #2464 by xen-rasmus
Could "-executionpolicy bypass" be a necessity here or does VSI_ShellExecute somehow handle that, if the executionpolicy in the system is set to 'Restricted'?

Please Log in to join the conversation.

11 May 2015 17:20 #2465 by d.geerlings
Hello Rasmus,

If your system is configured with a restricted execution policy then you will have to add the execution policy parameter. In practice this likely means that you will have to add it as a parameter as the default execution policy is restricted.

Please Log in to join the conversation.

  • Kaj
  • Kaj's Avatar Topic Author
12 May 2015 07:58 #2466 by Kaj
I may add, it was handled in a great way...in the end I used one of the other sugestions you guys gave me, by using a .bat file, that is calling the ps1 script. I did add the "-executionpolicy bypass parameter, because the security settings in my company require it. That will probably be true for the most of us, I think.

Please Log in to join the conversation.

Login VSI, Inc.

3945 Freedom Circle
Suite 670
Santa Clara, CA 95054

Phone: +1 844 828 3693

300 Tradecenter
Suite 3460
Woburn, MA 01801

Phone: +1 844 828 3693

Login VSI B.V.

De Entree 85
1101 BH Amsterdam
The Netherlands

Phone: +31 20 705 1200