question

JasonDalby-2886 avatar image
0 Votes"
JasonDalby-2886 asked Jason-MSFT commented

Install Win32 Apps with Scripts embeddet in the .intunewin

Hello Community,

i would like to install a Windows App (win32) with a Script which i include in the .intunewin file.

following example Scenario:

I want to install firefox. The Silent install command is firefox.exe /s. The uninstall command & "C:\Program Files\Mozilla Firefox\uninstall\helper.exe" /s. I put these commands in two different ps1 files.

  1. ffinstall.ps1 (for installing firefox)

  2. ffuninstall.ps1 (for uninstalling firefox)

Here are the Steps i do

  1. I put the Firefox.exe and the powershell scripts in one folder called Firefox

  2. With the IntuneWinAppUtil.exe i create a .intunewin file from from the content of the Firefox folder

  3. I create a Windows app (win32) and add the Firefox.intunewin file i created

  4. in the Tab where i add the install Command and Uninstall Commands i use the commands powershell.exe -executionpolicy Bypass -file .\ffinstall.ps1 for the install command and powershell.exe -executionpolicy Bypass -file .\ffuninstall.ps1 for the uninstall command

  5. In the Detection rules i add rule to detect the Registry Entry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla

  6. I assign the application

After some time the Application fails to Deploy which ist displayd in the Troubleshooting: Error code: 0x87D1041C The application was not detected after installation completed successfully

The Software didnt intstall on the Client. Im trying to Troubleshoot, i researched where the log files are being stored on the client. But there are no Logfiles whatsoever so i can figure out what actually happened. I searched under Micosoft Intune Management Extension but no Logs were created.

I would like to find out where the mistake ist and figure out how to Troubleshoot this issue. I Think this might make deploying executable Software a bit more comfortable. Im tyring to undertand a bit more the idea behind adding Software with Script, because i didnt even knew youre were able to do so.

https://social.technet.microsoft.com/Forums/en-US/b166ad27-dc2e-4e21-b701-53920b2507d7/how-to-use-multiple-uninstallation-commands-for-a-client-app?forum=microsoftintuneprod



mem-intune-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jason,
I have this exact same issue. In my case I'm deploying a custom powershell script to install an IP based printer along with it's driver all of which are packaged in a .intunewin file. I wanted to leverage having the driver cached locally. The odd thing is that this app install has been working until I tested it recently. The solution works on my test machine when running the install, detection, and uninstall scripts. The issue seems to occur upon deployment.

Unfortunately, the troubleshooting guide was circular for me "a user uninstalled the app after it was installed" but, I didn't. I'm still trying to figure out what changed and how I can fix it. Still working on the resolution.

0 Votes 0 ·

The problem is Intune Management Extension just fires the script and then it doesn't wait for the install, and it proceeds to perform the install detection before it is actually installed yet. And so it often gives a failed result even tho it then proceeds to install just fine.

You may have joy using Start-Process with -Wait to make the powershell script block for the install, or just put a Start-Sleep in your script to keep it alive for that amount of seconds to stop Intune from moving on to installation detect.

0 Votes 0 ·
Jason-MSFT avatar image
0 Votes"
Jason-MSFT answered Ian-WKIT edited
  1. Why would you put firefox.exe /s in a PowerShell script instead of just directly calling it?

  2. I can't tell you why your detection method is not correct. My guess is that you set it up to detect a value but only specified a key (what you have above is a key, not a setting/value).

  3. There definitely should be a log file under the IME folder. See https://www.anoopcnair.com/intune-win32-app-troubleshooting/ for lots of good info.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

For me there seems to be some situations where the directly called .exe forks off another process or something, and then Intune doesn't block and proceeds to do the install detection before the forked process has actually had a chance to install the software properly.

And so this is why I need to use a script wrapper to force intune to block while the install occurs. That is one reason for needing a script, I don't know OP's reason.

0 Votes 0 ·
AndyLiu-MSFT avatar image
0 Votes"
AndyLiu-MSFT answered Jason-MSFT commented

1 Instead of using PowerShell script, you can just use the install and uninstall commands directly in the App configuration settings. Please see the following screenshot for reference.

19650-image.png

2 Based on the error code, typically occurs when a user uninstalls an app manually after Intune successfully installed the app. There are other reasons, and you can refer to the error description as below. Please click here for more info.


19763-image.png

3 For IME logs, please go to C:\ProgramData\Microsoft\IntuneManagementExtension\Logs. Please just refer to the troubleshooting instructions for Win32 app issues by clicking the following link.

Troubleshoot Win32 app issues




If the response is helpful, please click "Accept Answer" and upvote it.


image.png (37.8 KiB)
image.png (64.3 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yea but for some processes (Install Shield .exe that unpacks and executes a .msi for example) Intune fires off the .exe, and then the .exe in turn forks a new process (Windows Installer to install .msi for e.g.) and Intune is not waiting for the .msi to be installed. It then proceeds to install detection and because the .msi has not finished installing, it happens that the software can't be detected and then intune says the installation failed, however eventually the .msi finished installing and it IS installed, but intune thinks otherwise.

That is why it is needed to use a script to essentially work around bad behaviour by Intune. It should block for all child processes that are spawned but doesn't seem to do so.

0 Votes 0 ·

That is why it is needed to use a script to essentially work around bad behaviour by Intune. It should block for all child processes that are spawned but doesn't seem to do so.

You're free to submit a suggest for this however this is not bad behavior in the IME. Changing the IME to wait on all child processes would cause the IME to wait on things unrelated to the installation, e.g., what if the installer spawns a process related to the app itself and not its execution -- this is more common than you think? Then the IME would be stuck forever waiting. Instead, this is poor design by the vendor of the installer.

0 Votes 0 ·
SheldonRyanLContractor-0682 avatar image
1 Vote"
SheldonRyanLContractor-0682 answered SheldonRyanLContractor-0682 edited

@JasonDalby-2886 - Change your path so that it uses the formatting for a legacy command, not a PowerShell command. (e.g. remove the ".\" before the file name)

Example:

Install Command - powershell.exe -ExecutionPolicy Bypass -File Install-TheThing.ps1
Uninstall Command - powershell.exe -ExecutionPolicy Bypass -File Uninstall-TheThing.ps1

YMMV, but this seemed to work fairly well in our limited testing. Good luck!


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

yannara avatar image
0 Votes"
yannara answered

I am transforming all my apps to execute on powershell nativelly (instead of .bat or .cmd), and I have overrun this by using cmd inside the package to call powershell, but I really would like to use native ps command line directly in win32 app.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.