I am trying to run a printer driver install from a vbscript when a Thinapped application is launched. The driver installation requires administrator privileges. I am using 'Elevate64.exe' from http://www.westmesatech.com/files/ElevationToolkit1.zip to launch the setup.exe during the "OnFirstSandboxOwner" call.
My script launches properly and lists the command, but despite the fact that 'setup.exe' and Elevate64.exe are in the same directory, I get a windows popup saying the 'setup.exe' cannot be found.
Running the command manually in a regular cmd window on the machine succeeds.
Has any one come across such an issue? What do you do if you need to run a thinapp script with administrator privileges.
When you run a VBscript in a ThinApp package, it is executed from C:\Program Files\ThinstallPlugins folder. So please modify your script accordingly.
Also, please have a look at this workaround for installing printer driver:
Thank you for the quick response. I created the script based on instructions in that document, but wasn't sure exactly where I would place the setup files. I will try what you have suggested and post the result here.
In the instruction document, the printer setup is kept under %ProgramFiles% folder in the ThinApp project folders.
That's what I did too. I created a directory (RF) under "%ProgramFilesDir" and copied all the setup files for the application under it. In addition, I added 'Elevate64.exe' to that directory, which lets the setup to be run with elevated privileges. My vbscript launches Elevate64 with "setup.exe" as the parameter, making sure that I am in the RF directory before I run it. The script launches, and I can see that I am running the command, but I get a windows error saying "setup.exe" is not found.
I am probably trying to launch the script in the wrong call back function, may be I should wait for the sandbox to be built before running it..
I made some progress.. Just for kicks I tried making a copy of the setup files on the virtual desktop's C:\program files\ directory where I am running the package from. And then it worked. The setup process launched and installed the printer driver on that machine.
So, it looks like when I am running the script, it's expecting the files to be on the machine where the package is running. I need to look at how to run the setup files from the package itself.
You can very well keep the setup files in the package. Can you post the VB script?
Please see attached.. The VBscript, which in turn calls a batch file in the setup directory. both included. I have also tried having the command line in the batch file being called directly from the vbscript.
I think when the privileges are elevated, the application can no longer see the directories in the package. I look at the %appdata% (sandbox) on the machine and I see that the Elevate64.exe has been copied to it, but nothing else. I have the isolation mode set to Merged for all the directories.
What happens when you don't use Elevate64.exe? Does it work?
Elevate64 launches and tries to run Setup.exe but cannot find it even though its in the same directory (in the thinapp package). However when I create that directory structure on the desktop where the thinapp is running, everything works perfectly.. but it defeats the purpose of doing the package..
Want to know what happens if you don' use Elevate.exe and directly launch setup.exe? Is the behaviour same?
It works fine when I launch it outside of thinapp. The same command line does not work when run from the thinapp package.
1. Can you enable cmd.exe in the package.ini? (cmd.exe will show the files and folders inside the virtual bubble)
2. Browse to the ThinApp project folder where you have copied the driver setup files and run the setup command?
I got an error while launching cmd.exe, but it did launch. I could see the files in the setup directory but got another error trying to launch the app. I think this is not due to the original problem. There is something wrong with the machine I am running this on. I will test on another clean machine and will post the results here. Thanks again for your quick responses.
Attached is a screenshot with the error. This is the original issue that I had.. google search for this error lead me to this being a user privilege (UAC) issue. That is when I tried to elevate privileges. But when I do that, it says Setup.exe cannot be found. I think when privilege is elevated, it cannot see anything in the file system - or it's changing the default directory to something else - I tried specifying the full path to setup.exe, but it still would not find it.. I am totally lost.. it looks like there is no way to run an application with admin privileges from Thinapp.
Can you try adding the below line in the package.ini under [BuildOptions], rebuild and check?