How to use Microsoft Intune to deploy scripts

As you know you can deploy only .exe and .msi files via Microsoft Intune.

The question is how to deploy script if you need to add a registry key, delete some files via script or deploy application with different then .exe format?

The short answer is using built-in packager IExpress or uploading cmd.exe with your script.

So, IExpress:

Be careful with version of IExpress: package created in Windows 7 will not work in Windows 10 and vice versa, so if you need a package for Windows 7 use IExpress from Windows 7. Easy rule!

Choose an option “Extract files and run an installation command”:

We don’t need a user’s approval:

Add files that have to be included in our package:

Specify a command for application installation:

Run the command in the hidden mode:

We don’t need some messages after installation is complete:

Target path for your package:

Restart is not required:

Also you can save configuration file if you need to modify a package later:

Then we upload this file in Microsoft Intune:

As I said earlier the second option is run cmd.exe with your script. In my case I had to create a script, because I needed to add two registry keys before the IE-plugin installation. The script is very simple:

reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v C:\Windows\SysWoW64\msvcp100.dll /f /t REG_DWORD /d 4096
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\SharedDlls" /v C:\Windows\SysWoW64\msvcr100.dll /f /t REG_DWORD /d 4096
msiexec /i /quiet /norestart

Save in one folder your .cmd-script, .msi and cmd.exe from C:\Windows\System32:

Upload into Intune cmd.exe and all additional files for installation:

After uploading a package into Intune, we need to open it for editing and providing command line arguments for cmd.exe:

In the same manner I deployed PowerShell v3 on Windows 7 as an update that you can’t upload because of unsupported format – .msu:

wusa.exe "Windows6.1-KB2506143-x64.msu" /quiet /norestart

Leave a Reply

Your email address will not be published. Required fields are marked *