Error on start-process with credentials when packaged with alternative credentials

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 6 years and 10 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
bottle
Posts: 1
Last visit: Wed Sep 27, 2017 4:06 am

Error on start-process with credentials when packaged with alternative credentials

Post by bottle »

Product, version and build: PowerShell Studio 2017 version 5.4.139.0
32 or 64 bit version of product: 64
Operating system: Windows 10 Build 1703
32 or 64 bit OS: 64
PowerShell Version: 5.1.15063.0


Let's say we have local credentials named public and admin

I've packaged my script with alternative credentials (RunAs user) as "admin" and i run the exe under the account "public".
Within the script I have:
Start-Process powershell.exe -credential $publiccredential
where $publiccredential is the cred object for account "public"
and it throws error "The application was unable to start correctly (0xc0000142)"

Without packaging the script with alternative credentials, I don't get the same issue.
This is running on a clean install of Windows 10 build 1703

Am I doing something wrong here?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Error on start-process with credentials when packaged with alternative credentials

Post by davidc »

When you use the RunAs, you have to make sure the RunAs account has access to the folder where the executable is located otherwise it will fail to run.
David
SAPIEN Technologies, Inc.
This topic is 6 years and 10 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.