Extraction of VBScript from PrimalScript packaged executable

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 8 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
pmadison
Posts: 5
Last visit: Tue Mar 10, 2020 1:32 pm

Extraction of VBScript from PrimalScript packaged executable

Post 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.
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 times

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
pmadison
Posts: 5
Last visit: Tue Mar 10, 2020 1:32 pm

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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?
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 times

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 times

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 times

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
pmadison
Posts: 5
Last visit: Tue Mar 10, 2020 1:32 pm

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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.
User avatar
pmadison
Posts: 5
Last visit: Tue Mar 10, 2020 1:32 pm

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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?
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 times

Re: Extraction of VBScript from PrimalScript packaged executable

Post 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 5945 times
Attachments
HelloWorld.zip
(304.64 KiB) Downloaded 261 times
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 7 years and 8 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.