Page 1 of 1

Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 8:57 am
by pmadison
Packaged with Primal Script 2016 7.2.90.0 64 bit

Issue confirmed independent of OS, but experienced on: Windows 8.1 Pro 64 bit, Windows 7 Pro, Windows 10

I have a packaged VBScript file that is run with Alternate credentials using the "RunAs user" Run Mode. The RunAs user is necessary as the script is initiated by non admins, but requires admin privileges. Before I updated PrimalScript, it would extract a .vbs packaged executable to the "C:\Temp" folder and then execute from there. This has worked excellent for years. With the latest update(Or at least my latest update after I got around to updating), listed above, It is now extracting the temp vbs file to the location that the script was called from. The packaged script is actually called from a group policy logoff script. Since the logoff script is executed from "C:\Windows\System32\GroupPolicy\User\Scripts\Logoff", it is now trying to extract the packaged .vbs file to that location. The .exe is actually in another folder. Since the logoff script is run as a non admin, it does not have permission to create the script in that folder, so the process now fails. Other than going back to a previous version of Primal Script to get it to extract to c:\temp, is there a way I can designate where executable extract the temp VB script to? If it could extract to where the executable resides, rather than where it is called from, that would work. Currently the process still works if the user is an admin on the PC, but not if they are not an administrator. I don't want to grant non admins write access to the "C:\Windows\System32\GroupPolicy\User\Scripts\Logoff" folder.

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 9:47 am
by Alexander Riedel
Can I ask why you are not using the SAPIEN Script Host which does not require the use of temporary files and is much more secure?

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 10:11 am
by pmadison
I am not opposed to that, but for some reason and with this script, I get the following error when packaging with that engine:

"Cannot run Script, error: The filename, directory name, or volume label syntax is incorrect."

Do you know what can cause this issue when the only item changed is the engine type?

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 10:26 am
by Alexander Riedel
Can you provide more details what exact engine, platform etc you chose?
Please also include where (full path) the actual script is located so that maybe we can recreate that situation.

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 10:30 am
by Alexander Riedel
Most likely you use RunAs and create the exe in a folder that is only accessible to the current user.
When it tries to relaunch itself as the designated user, the exe is not accessible to the other user.

Move or create the exe in a folder that is accessible to all users if that is the case.

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 11:15 am
by Alexander Riedel
I'll see if we can add an option to re-instate the C:\Temp folder with the next build or as an automatic option if the current folder is not accessible.

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 11:22 am
by pmadison
Concerning the error: "Cannot run Script, error: The filename, directory name, or volume label syntax is incorrect."

The executable is located in a folder that all users have access to. The folder is used for multiple items and is created for company scripts. So any folder created would mimic our location. Specifically I put this in "c:\ourcompanyname\scripts". I get the error with the Sapien script host (Windows) x64 engine and also with the x32 engine. I have tried both embed a default manifest for elevation as well as without elevation. All other settings are default.

Concerning this not running with new version of Primal:
The engine I use for this is Wscript x64. When I use this engine, I can get the script to execute from the "C:\Windows\System32\GroupPolicy\User\Scripts\Logoff" folder 9where it is called from our logoff script0 if it is an administrator logging off. If I build it with the Wscript 32 engine, it will not work for any user, whether or not they are an admin.

So this would work if I could get the Sapien Script Host to execute, or if I could get the wscript engine to extract the .vbs from the packaged executable to a user designated or non admin friendly location.

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 11:24 am
by pmadison
Alexander Riedel wrote:I'll see if we can add an option to re-instate the C:\Temp folder with the next build or as an automatic option if the current folder is not accessible.

That would be great! Any ideas for now, or should I go back to a previous version to build for now?

Re: Extraction of VBScript from PrimalScript packaged executable

Posted: Wed Jun 22, 2016 1:49 pm
by Alexander Riedel
The attached is a hello world vbs packaged as a 64 bit exe. Please try and execute this on your machine and let me know if this works.
These are the settings I used:
packager settings.png
packager settings.png (46.08 KiB) Viewed 3347 times