I am attempting to simply run a VBScript or batch file from the “Files” folder using the AppDeployToolkit. The “Files” folder also contains my installation files (MSI or EXE). I would like to call a VBScript or batch file within my toolkit be either using the cscript.exe or cmd.exe commands respectively. Unfortunately I am not having much luck accomplishing this. Any help would be greatly appreciated!
This VBScript code is a prerequisite provided by Microsoft to install Internet Explorer 11. I am not a scripting expert which is why I have turned to the community for assistance. I do not know how to convert the script to PowerShell. I am hoping there is an easy way to “call” a vbs file and once complete continue on with the AppDeployToolkit.
The PowerShell AppDeployToolkit will not run when adding the line of code you provided. I updated the code with the name of the vbs file for which I am running.
I see a post with another user experiencing a similar issue which seems to have been resolved but it still doesn’t work for me. I keep getting “Installation Failed”. This is the only command running in my “Deploy-Application.ps1” script.
It looks like I am getting closer. I can see that in the logs it does explicitly show the quotations around the path for the VBS file however installation is still failing.
[Installation] :: [C:\WINDOWS\System32\cscript.exe] is a valid fully qualified path, continue. Execute-Process 09/02/2016 8:50:18 AM 2032 (0x07F0)
[Installation] :: Working Directory is [C:\WINDOWS\System32]. Execute-Process 09/02/2016 8:50:19 AM 2032 (0x07F0)
[Installation] :: Executing [C:\WINDOWS\System32\cscript.exe ”C:\Users\jhamelin\Desktop\Internet Explorer 11\Files\updatecheck.vbs”]… Execute-Process 09/02/2016 8:50:19 AM 2032 (0x07F0)
[Installation] :: Execution failed with exit code [1]. Execute-Process 09/02/2016 8:50:19 AM 2032 (0x07F0)
Any ideas what might be causing this? I have seen some people use the -Arguments parameter instead of the -Parameters parameter. Both don’t seem to work for me.
do not copy and paste the code out of here directly into your script. There may be odd characters hidden in what you copy. Type it out fresh in your deployment script.
Look at the examples folder that comes with the toolkit. Look at the office2013 example. In there, you’ll see examples that call vbscripts. Search for .vbs in there to find a good example.
The script you’re trying to execute may have issues itself. It may require access to HKCU which will not be available if run under the system context. It may simply have errors in it.
I was copying the text directly from the site which does change the formatting in NotePad++.
Using the Office2013 example provided the exact formatting that was required for calling the VBS file.
When testing I was running the “Deploy-Application.exe” locally using an Administrator account and not SYSTEM.
You have been a great help and I highly appreciate your assistance pointing me in the right direction! I wish I took a look those examples to begin with.
Guys, I think the problem is that you are passing the $dirfiles variable to cscript.exe or cmd.exe. Those executables do not understand the $dirfiles variable, so they choke. $dirfiles is only known to the PSADT script. If it was “execute-process -path $dirfiles\blahblah.exe” it’s all good. But when you try to pass it as a parameter string to CMD or CSCRIPT, it has no clue. So what you might want to do is copy the file to a temp directory earlier on in the script, then call it from that temp directory. You also could try —> execute-process “cmd.exe” -parameters $dirfiles"\script.bat" But I do not know if that will work.