Interactive installation with the InTune Win32 app
Tags: intune, powershell
Published: 2023-03-29 12:51:34

## Backgrouond
Win32 apps are often used when distributing apps using Intune.
Unfortunately, Intune cannot be installed without silent installation.
It would be nice if all apps were installed silently, but in reality there are many cases where this is not the case.
After a lot of research, I found that there are people in overseas communities who are having the same problem, and the following countermeasures have been published.

[Use ServiceUI with Intune to Bring SYSTEM Process to Interactive Mode](https://www.anoopcnair.com/use-serviceui-with-intune-to-bring-system-process-to-interactive-mode/)

Isn't there a way other than ServiceUI? I thought, and I suddenly thought that I could do the same thing with psexec? I tried it and it worked, so I'm writing an article.

I think that it can be used for those who are in trouble because they cannot install interactively with Intune's Win32 application distribution, or for temporary support until creating a silent installation package.

## About psexec
I will omit the explanation about psexec, but it is a tool published by MS. You may use it when you want the process to run under the System account.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/357t5l055ss6hyojivnq.png)

You can use the -i command line option to interact with the specified session.

In the installation command when executing app distribution with intune,

psexec.exe -i <session ID> <Install Command> /accepteula

By doing so, I think that you can connect the screen to the user's session ID while executing the installation command with the System account.

## Example(7-zip)

I'll try it right away, prepare 7-Zip to be distributed with PSAppDeployToolkit, and put the above psexec in the installation command to achieve interactive installation.

I will also omit the explanation about PSAppDepolyToolkit, but it is a collection of helper scripts that you want to have such functions when distributing applications with SCCM or Intune. It's hard to make by myself, so I'm grateful that something like this is open to the public.

[PSAppDeployToolkit](https://psappdeploytoolkit.com/)


## File Structure

The source file folder looks like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rps8hc3s1y9tu635lmas.png)
Place the installation files under Files.
This time it will be like this.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jf6mpb2x397zseey8qfd.png)

## Install Script

In the INSTALLATION section write like this.
Acquire the session ID of the logged-in user on the first line (acquire the session ID of Explorer.exe)
The second line uses psexec to actually execute the installation command.

```
$sid=(Get-Process -Name explorer).SessionId
Execute-Process -Path "$dirFiles\PsExec.exe" -Parameters "-i $sid /accepteula $dirFiles\7z1900-x64.exe" -WindowStyle 'Normal'
```
I have the actual file here.

[Deploy-Application.ps1](https://github.com/keitanak/IntuneWin32Sample/tree/main)


## Building IntunWin file

Under this folder I kept a set of PSAppdeploy files.
D:\Documents\Intune\Apptest01\Toolkit

The IntuneWin file for uploading was created as follows.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jn0zb0cifpale07tbo61.png)

## Intune Setting

The Install command can be left as it is PSAppDeployTookit.
Silent is attached, but this is an instruction for PSAppDeployTookit, so the actual installer screen is displayed.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ujgpu6dx7oasg3cjs7y.png)

## Test Installation result


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylozdoh2lplmgljvjfsj.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/88d4bo3nc3si2fmsdorn.png)

The installer screen of 7Zip was displayed properly.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w9uiz0j35y7uevmnii3.png)

It completed normally.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eacf8n5rh4yb6sv8nuio.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fist7nxepit0k19tv8wo.png)

There is no need to make 7Zip interactive, but it seems to be useful for things that require more complicated installations, and for printer drivers and other interactive applications.

## Closing

If you think about it, the problem is that you can't do this with Intune in the first place. I posted it on the MS Feedback site, so if you agree, please vote.

[Ability to allow Win32 Application(System context) Interactive installation](https://feedbackportal.microsoft.com/feedback/idea/bc1837a6-29c6-ed11-a81b-002248519701)

Enjoy your Intune life!