Page 1 of 1

User privileges stored in Package

Published: June 11, 2018 - 6:55 PM
by hasbeen
Hello,
A PowerShell file "scripttest.ps1" creates two different text files:
- one with a path on the machine's local hard drive (C:\test\coucou.txt),
- the other with a path to a server share (\\server-ip\share\salut.txt).
1) When I open and run "scripttest.ps1" from the Ps1_To_Exe_(x64).exe interface, both text files are created.
2) When I create the scripttest.exe file from Ps1_To_Exe_(x64).exe and then run it, both text files are created
(Ps1_To_Exe_(x64) settings: 64-bit Exe-Format | Windows (invisible), UAC Requires User Privileges).
3) When I run scripttest.exe from the PyScripter interface ("make and edit" then "Run Configuration / install / Run"), both text files are created.
4) When I create the wapt package (Run Configuration / -i build-upload / Run) and assign it to a machine, the script runs, the local text file on C:\test is created, but the remote text file on \\server-ip\share is not created.
It would seem, therefore, that this is a problem of lost user privileges. How could I fix this, please?
Thank you in advance.

WAPT server 1.5.1.23 on Debian Stretch, option 1 in Post-configuration "registration without authentication (As in version 1.3)".

Re: User privileges retained in Package

Published: June 12, 2018 - 08:33
by sfonteneau
Hello,

Wapt is running under the system account.

Why not store the ps1 file directly in the package?

It is generally strongly discouraged, from a security standpoint, to store a script outside the Wapt package. This completely breaks Wapt's security.

Re: User privileges retained in Package

Published: June 13, 2018 - 3:24 PM
by hasbeen
Thanks for the reply.
That's exactly what's been done: the .ps1 script is integrated, as an executable, into the wapt package.
Perhaps I could integrate the .ps1 file directly into the package (I'll try), but the initial question concerns its executable, which works all the time except when it's inside a package.

Re: User privileges retained in Package

Published: June 13, 2018 - 10:17 PM
by sfonteneau
The machine account most likely does not have access to your share.

To better understand, you can run your script with psexec using the -s option:

https://docs.microsoft.com/en-us/sysint ... ads/psexec.

This will allow you to observe the problem.