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 SUBSCRIPTION NUMBERS, LICENSE 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.
User avatar
UCPocoAPocoToo
Posts: 32
Joined: Sun Mar 03, 2013 12:45 pm

Issue Running with Alternate credentials in Script packager

Post by UCPocoAPocoToo » Tue Dec 20, 2016 6:14 pm

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: 7121
Joined: Tue May 29, 2007 4:43 pm

Re: Issue Running with Alternate credentials in Script packager

Post by Alexander Riedel » Tue Dec 20, 2016 6:37 pm

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
Joined: Sun Mar 03, 2013 12:45 pm

Re: Issue Running with Alternate credentials in Script packager

Post by UCPocoAPocoToo » Tue Dec 20, 2016 6:52 pm

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!