Commandline execution

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
cmartin16
Posts: 3
Last visit: Wed Aug 18, 2021 12:35 pm

Commandline execution

Post by cmartin16 »

I retired a couple of years ago and haven't used Powershell Studio since then. I recently took a temporary job and got a new version of Powershell Studio, but compiling scripts doesn't behave the way I remember.

If I compile a script using the "SAPIEN Powershell V5 Host (Command line)" Script Engine option, it will open a new console when I run it from a Powershell window and all output goes to that new console with no way to recover it without just looking at it.

If I simply open a folder browser and double-click on the executable, it opens a console, then opens a second console. The output is directed to this second console.

I found a video from this past July at https://www.youtube.com/watch?v=5khkPaSNAU4 where the demonstrator was using PrimalScript Editor to do the same thing, and it did not open the extra console. Output was passed back to the calling Powershell window.

So what am I missing? Has my memory slipped? Is there some setting I haven't checked, or is this just how Powershell Studio works now. Should I have gotten a copy of PrimalScript Editor instead?
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Commandline execution

Post by brittneyr »

[Moved to the PowerShell Studio Product Forum by Moderator]

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:
32 or 64 bit version of product:
Operating system:
32 or 64 bit OS:

*** Please add details and screenshots as needed below. ***
Brittney
SAPIEN Technologies, Inc.
User avatar
cmartin16
Posts: 3
Last visit: Wed Aug 18, 2021 12:35 pm

Re: Commandline execution

Post by cmartin16 »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.167
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.15063.0
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Commandline execution

Post by Alexander Riedel »

Are you using RunAs in the packager settings to execute the script under different user credentials?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
cmartin16
Posts: 3
Last visit: Wed Aug 18, 2021 12:35 pm

Re: Commandline execution

Post by cmartin16 »

Yes, this needs to be run with a service account.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Commandline execution

Post by Alexander Riedel »

Then this is expected behavior. The exe basically launches itself with the specified credentials. Since you cannot run a process as user B in a console that runs as user A, Windows creates a new console.
It *might* be possible for us to redirect the output back to the original console. I would have to investigate that.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.