Update 2018-04-23: Due to issues with download and for better tracking the script has been moved to github. Link at the bottom of the post.
Update 2016-08-02: Someone asked, could it not be possible to run external vbs and ps1 scripts as well. Well hat has now been fixed and the new version is available for download.
Current versions support the following installertypes, EXE/MSI/MSP/VBS/PS1. Happy deploying!
My good friend “The Deployment Bunny” did a while back a nice script to install Internet Explorer 11 into a ref image. I now needed a nice way to deploy other applications using the same principle and way to deliver this to customers.
The problem now is most don’t want to edit the script every time a new application should be used. To sort this out the script uses a settings.xml file to specify the needed parameters.
The XML in itself is a short simple one as can be seen below.
<xml>
<Application>
<Name>Oracle Java <InstallerName>jre-8u40-windows-i586.exe</InstallerName>
<InstallerType>EXE</InstallerType>
<InstallSwitches>/s</InstallSwitches>
</Application>
</xml>
Now all that has to be changed for this to work with other applications is the Name, the file to run and the install switches. If you change to run a MSI instead just change installertype to MSI.
The folder structure for it to work needs to look like this and the install files is then place inside the Source folder.
This can then either be run by simply running the PowerShell script from the folder or by calling on it from inside SCCM or MDT. The Install command from MDT and SCCM is then “cmd /c PowerShell.exe –ExecutionPolicy ByPass –File install-applications.ps1”
If you run this inside of MDT or SCCM and in a Task sequence the logging will be done to the relevant logfolders used by MDT and SCCM.
The script can and a sample settings.xml can be downloaded from here on github
Happy deploying!
Hi, the url to the file on your onedrive broke, could you please fix it, so the file can be retrieved? Thanks! Cheers! Rens
LikeLike
Thanks for letting me know. The link should be fixed now.
LikeLike
Hi, thanks indeed I can now download the script again. I had this on my own website a couple of times where onedrive files weren’t found any longer.
LikeLike
If I run this using CMD it works fine. I’ve tried this with your Oracle example and a few other MSI and EXE installs.
If I run it via MDT, I’m getting: “Application [NAME] returned an unexpected return code: -196608”.
My Application details look like this:
cmd /c PowerShell.exe -ExecutionPolicy Bypass -File Install-Application.ps1
Any ideas?
LikeLike
hey, that is because mdt nativley starts all applications with cmd /c so your commandline will cause a double cmd /c and that wont work. Just remove the cmd /c part from your application command and it should be fine.
/Peter
LikeLike
That was it! Thanks. 😉
LikeLike
Thanks for the great wrapper!
What about starting .vbs or .ps1 the same way as .msi & .exe?
It happens quite often that you have to script something before or after installation, and it would be good to do it with the same method through an external script instead of having to make changes in the installation script.
LikeLike
Hi Thomas,
Thats would be a good addtion. I will try and add it as soon as possible 🙂
/Peter
LikeLike
I’m unable to download the script using your link.
LikeLike
This script has been moved to Github instead so it should be no problems downloading it now. Thank you for notifying me
LikeLike
Hello Peter,
Thanks for your job, it’s perfect.
Just a question. When I use the script in SCCM, the PC reboot automatically.
Have you any idea?
LikeLike
The script in itself does not reboot ever. The reboot needs to be controlled as part of the install switches. Which switches are you using and for what application?
LikeLike
Can this be used to install two MSIs in sequence, or do I need to write another ps1 file to do that and feed it into install-application? I’d rather not create two separate apps in MDT for the two MSIs.
Thanks,
Ilona
LikeLike
You can sequence how many msi/exes you want. Just copy the Application block and place it below the first one but still inside the XML tags
LikeLike
Can you use this to uninstall apps?
LikeLike
Not out-of-the-box since the commands to uninstall would be diffrent to the commands for installing. However that being said creating a wrapper for uninstall is not impossible and the script could be modified to do uninstallations.
LikeLike
Is it as simple as changing the /i to a /u or x. Or would you eed the guid and all that. I would love for some one to create that script
LikeLike
Hello
If this script is software that requires user interaction to install the gui, it will return a value of 0 if the user cancels the installation. This can easily cause sccm installation judgments. The user does not install but the status is displayed successfully. Is there any good way to solve it, check the conditions or Exit code for the original installation of the installation file?
LikeLike
The script already checks for the exit code of the setup, but setups that are cancelled are generally returning 0. I would advise staying clear of user guided gui installs as part of SCCM. There are numerous issues with that.
LikeLike
Nice wrapper!!! Will the “Settings.xml” support adding MULTIPLE apps in one? For example if you need to install 2 EXE components as one app to be used by Intune since Intune does not have a install order option.
LikeLike
Yes it already does, just copy the the block and put it below the first inside the configuration block and the wrapper will automatically run all installs in sequence
LikeLike