Copying files to devices through Intune does not work

Brass Contributor
Can I use Intune to copy files?
Prepare a folder and add all the necessary files that you want to copy to managed devices. Next, create a cmd file with the instructions to copy all the files previosuly added and place it on the same folder. Download the Microsoft Intune Win32 App Upload Prep Tool and extract it to C:\Temp\ IntuneAppTool
 
I have prepared as per what is said here above, where I want to copy 2 files to a folder in the Autopilot devices.  There is a cmd file that has the copy command to copy files and I packaged it in intune and pushing it as win32app and it is not copying the 2 files that I had in the folder.
 
My question is in that folder should it have both the files and the cmd file is also is in the same folder. Is that fine?  I have a folder where the 2 files are there and i have the cmd file also in that same folder. Now I use this folder as the source folder while packaging it. I tried running it as user context (user is not a local admin) and system context, but it would not copy. Any suggestions or thoughts please where the problem is.
 
CMD file

REM create Directory

cmd /c mkdir "C:\Temp\Folder2"

xcopy FILE1.JPG "c:\Temp\Folder2" /y

xcopy FILE2.JPG "c:\Temp\Folder2" /y

 

3 Replies

@oryxway390 

 

Take a look at these articles on packaging IntuneWin apps to ensure you're bundling in everything you need and following all the steps.

 

Best Guide Intune Win32 App Deployment | Endpoint Manager 

 

Relative File Paths in Powershell 

 

It's okay to put things all in one directory if needed, but the second link has some tips on scripting you might want to consider. Instead of copying to a literal path of c:\temp you should try using relative paths or the $scriptroot variable, which will put you in the correct location of your content wherever Intune caches it, which would make things more flexible.

 

Please like or mark this thread as answered if it's helpful, thanks!

@oryxway390 : You can checkout my blob post where I explain how to copy an exe to an specific location. For sure you can easily adapt this to other file types.

 

Deploy a Win32 App with Intune (Cmtrace) – Modern Device Management (jannikreinhard.com)

Agree with my colleagues Jannik and Kurt.

Good luck!
Moe

In this blog I copied Lockscreen image to C:\Windows\folder.
https://cloudbymoe.com/f/change-windows-10-pro-lock-screen-using-intune