Copy file to a

You might need to deploy files/folders to windows mobile devices via Intune. Unfortunately, there is no direct way to do this, but you can use win32 app deployment to achieve this.

I came across an issue that windows update broke the audio driver and only the driver downloaded from the Lenovo website can fix this. So I will copy an audio driver package to the user’s desktop, and let them run it.

First I downloaded the package file and renamed it as L13Audio.exe.

Step 1: Create a folder named package in C drive

Step 2- Copy the file L13Audio.exe to the package folder.

Step 3- Create a PowerShell script as below with file name PSscript.ps1 in the package folder.

$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$Source = “$PSScriptRoot\L13Audio.exe”
$Destination = “C:\Users\Public\Desktop\”

Copy-Item -Path $Source -Destination $Destination –Recurse -Force

 

Step 4- Create a batch file Copy.cmd

@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%PSscript.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'"

Then create another batch file uninstall.cmd

@ECHO OFF
del /f “C:\Users\Public\Desktop\L13Audio.exe”

Step 5- Download  Microsoft Win32 Content Prep Tool to a folder, such as c:\tmp.

Step 6-  Create a Win32 Intune package

Before running this, you should have 3 files under c:\package, Copy.cmd, L13Audio.exe, and PSscript.ps1. Run CMD:

CD C:\tmp

IntuneWinAppUtil.exe
Please specify the source folder: C:\package
Please specify the setup file: Copy.cmd
Please specify the output folder: C:\package
Do you want to specify catalog folder (Y/N)?n

Now you will have Copy.intunewin created for deployment.

Step 7-  Sign in to the Azure portal and select the Intune blade.

Step 8-  Select Client apps –> Apps –Add

Step 9- Select app type “Windows app (Win32)”

Step 10 – Select the app package file which we created in step 6.

Step 11- On the program tab,

  • Install command: Copy.cmd
  • Uninstall command: uninstall.cmd

Step 12 – Requirement tab

  • System Architechture: select 32 and 64
  • Minimum operating system: select it according to your environment
  • Disk space required (MB): Bigger than the size of the file

Step 13- Detection rules tab

  • Path: C:\Users\Public\Desktop\ (you type your path)
  • File or folder: L13Audio.exe  (you type your file name)
  • Detection method: FIle or folder exists

Step 14- Assignments

  • Assign to the group of user, recommend you create a group of test user first, then push to all the other group.

Step 15- Review + create tab. Create the package.

Deploy an exe application package

 

IntuneWinAppUtil.exe -c C:\Temp\NotepadPP -s C:\Temp\NotepadPP\npp.8.1.5.Installer.exe -o C:\Temp\NotepadPP_Packed -q

 

-c <setup_folder> Setup folder for all setup files. All files in this folder will be compressed into .intunewin file. Only the setup files for this app should be in this folder.

-s <setup_file> Setup file (e.g. setup.exe or setup.msi).
-o <output_file> Output folder for the generated .intunewin file.
-q is specified, it will be in quiet mode.

The install and uninstall page will be:

 

Reference

Win32 APP prepare: https://docs.microsoft.com/en-us/mem/intune/apps/apps-win32-prepare