Deploy file to workstations with Microsoft Intune

Microsoft Intune is a very powerful tool for Azure administrator and can be used to perform a large number of tasks. You can set policies, deploy packages, run PowerShell scripts on azure domain-joined devices. This post is related to copy files or folders to the user’s desktop using Intune.  I am creating a PowerShell script and batch file then I will convert them to Win32 Intune package for deployment.

Push Files via Intune

Let’s start.

Step 1: Create a folder named  package in C drive

Step 2- Copy the file or folder which you want to copy to the desktop using Intune.

Step 3- Create a PowerShell script as below with file name PSscript.ps1

$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$Source = “$PSScriptRoot\name of file or folder”
$Destination = “C:\Users\Public\Desktop\”

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

Step 4- Create a batch file Install.cmd

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

Step 5- Download  Microsoft Win32 Content Prep Tool

Step 6-  Create a Win32 Intune package

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

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, follow as below screenshot

Copy file using intune

Step 12- Requirement tab

Add app using Intune

 

Step 13- Detection rules tab

Intune App detection rules

Step 14- Assignments

Intune Group Assignment

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

I hope this small tutorial will help you to copy files or folders to workstations using Intune.

4 Comments
  1. michael says

    Hi does this copy the install.cmd file as well? if so how can you have the install.cmd file removed after copying the folder you need with just the basic files? i am trying to copy an app to the desktop which works successfully,, but it requires an additional file for the software to work. I am pointing it to the public documents folder but our documents folder is redirecting to one drive and it does not copy to that specific documents folder. The students do not have access to the c drive to get in to the local documents folder. Thank you for your assistance.

  2. Eelco Akker says

    Thanx so much, works like a charm

  3. Ryan says

    Just wanted to throw out a warning that copying and pasting the Install.cmd file for me did not work, but manually typing it in did work for anyone who runs into an Execution issue.

    1. Jannis says

      Thanks Usman for the script, and thanks ryan. you’re the GOAT! 🙂

      for me, the script also ran into an installation error.
      the problem is that it copies the ” characters incorrectly. if you delete them and manually set a new path in the install.cmd, everything works fine.

      greetings and stay healthy
      jannis

Leave A Reply

Your email address will not be published.