Issue Running with Alternate credentials in Script packager

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 7 years and 3 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
UCPocoAPocoToo
Posts: 32
Last visit: Tue Oct 22, 2019 7:12 am

Issue Running with Alternate credentials in Script packager

Post by UCPocoAPocoToo »

Product, version and build:
Version 7.2.97 2016
32 or 64 bit version of product: 64 bit
Operating system: windows 7 64 bit
32 or 64 bit OS: 32 and 64 bit OS (windows 7)

Hi,

I am having an issue with the use of Alternate credentials within the output settings of the packager settings.
Under Alternate credentials I have User name: I input mydomain.com\DomainUserAccount ( This DomainUserAccount is a member of the local administrators group)
Password: I input the password for DomainUserAccount .
Run Mode: is set to current user.

Scrip engine: Sapien PowerShell v5 host (windows)
Target: Microsoft windows 32 bit

when I compile the ps1 script to an exe file, logon to a windows 7 device with a domain user that DOES NOT have administrators rights, launch the compiled exe, I get an error message that says you do not have right to run the script. Its basically running an msi from a network location. If I login the device with an account with administrators privilege, it works without issues. I just can't seem to get the elevation to work. I remember in the past(much older version of the software) I did something like mydomain.com@DomainUserAccount and that worked years ago.
My question is, How do I get the script to run elevated with an account that is part of the local admins group? Am I inputting the username format correctly?

I also tried with the local administrator account as I've seen in the forum localhost\administrator with the correct local administrator's password. that did not work either. Please help.

Thanks in advance.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Issue Running with Alternate credentials in Script packager

Post by Alexander Riedel »

Err, if you select "Current User" for run mode, your user id and password just get ignored. You will need to set either Impersonate or RunAs user to actually have this have an effect.
Depending on you UAC settings this MAY not even be enough and you need a two step process.
Since elevation is evaluated (per manifest) before a process is even started, a "RunAs" would not be executed before the elevation prompt.
So you need one process use RunAs, which gets you from a 'normal' user to the desired user. The another process with an elevation manifest to reach full admin privileges.

Since you are executing MSI files, Windows Installer may do the elevation part for you though.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
UCPocoAPocoToo
Posts: 32
Last visit: Tue Oct 22, 2019 7:12 am

Re: Issue Running with Alternate credentials in Script packager

Post by UCPocoAPocoToo »

I didn't realize there were other options other than current user. In the past, there was a dropdown with 3 selectable options. However, I had to click on the little down arrow to select impersonate user and that did the trick. My script is working as expected. Thanks you sir!
This topic is 7 years and 3 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.