Run Applications in Intune Company Portal on Demand

Have you ever wondered, if you can run an application or script on Demand with Intune Company Portal, like you could do in SCCM / ConfigMgr when choosing Packages instead of Applications?
Currently this is not possible out of the Box with Intune, but today I want to show you, what you can do to still get it to work. If needed, you even can combine it with the ServiceUI from ( to make it visible to the end user.

What are the challenges to get a Script or Application available on Demand in Intune? We need a detection that is not fulfilled before the click on install, will be fulfilled after the Installation finished and will be again not fulfilled once the user wants to start it again. We can archive this by using a small PowerShell script that will create a RegKey at the end of the installation, that we use as detection. This will work for the first run, but what about future tries? We simply create a ScheduledTask at the end of the Installation, that will remove the RegKey that we created after 300s and after a Reboot, to make sure the next time someone tries to start the App in Company Portal the detection is no longer fulfilled.

Let’s start with the Script that creates the RegKey and the Scheduled Task. I uploaded a sample to GitHub:

For our example we are here using the Visual Studio Setup in combination with the ServiceUI in order to let the users access and interact with the setup on Demand. I simply modified line 5 to match the Appname and added in line 15 the run command of the setup with the ServiceUI:

Once the Script is ready, we can prepare the Folder that will be wrapped to the needed intunewin file. In the Folder we will need this script, in our case the ServiceUI and the actual App / Script that should be run, so here it will look something like this:

Next as usual we can call the Win32 Content Prep Tool in order to wrap the files

Once the file is ready, we can upload it to Intune, edit the metadata as needed

As an install command i use:

%windir%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy bypass -File Intune_OnDemand_Packages.ps1

As a detection, we will use the RegKey created by my script: (Computer\HKEY_LOCAL_MACHINE\SOFTWARE\MikeMDM\Intune_OnDemand_Packages\VisualStudioSetup)

Once the App is ready, we can start if on our client from the Company Portal. Initial there is as expected neither the RegKey nor the Scheduled Task, so the installation will start:

Once we click on install, we see the Visual Studio Setup

Once we are finished with our setup, the script will create the RegKey and the Scheduled Task that will wait 300s to delete the key, in order to get the wanted “Installed” State in Company Portal

When the 300s (or a reboot) are finally done, you can see that the RegKey is deleted and you can start the setup again if you want:






Leave a Reply

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