SOLVED

Creating a folder containing multiple files and sending to devices via intune

Super Contributor

Hi all, 

 

I desperately need some help! And just thought Id post on here to see if someone can help! I need to create a folder on client machines in the c drive (Folder name: Spanish Games) which I then deploy a bunch of files to this folder I create 

 

I have had a look and seems like I need to create a win32 app container with all in, script and files. 

 

What would I need to include in the script to get this to work? I have had a look at docs online but cant find one that deploys a folder and files too. I have found this: https://pariswells.com/blog/intune/copy-file-to-workstations-with-windows-intune but dont really understand some of it. 

 

Any help would be great!! Thanks in advance

22 Replies
best response confirmed by AB21805 (Super Contributor)
Solution
Hi it would look like this

c:\intunepackage\
Inside this folder you need to create a folder "spanishgames"
Copy everything you have inside this folder
Create a powershell script (install.ps1) inside the c:\intunepackages\ folder
Inside the script,

-first create a new directory where the files need to be copied to (destination)

New-Item -Path "c:\" -Name "SpanishGames" -ItemType "directory" -force

-Then create a command to copy everything to the folder you you created

Copy-Item -Path "spanishgames\*" -Destination "C:\spanishgames" -Recurse -force

Now we have everything in place... open the intunewinapptool and specify the folder c:\intunepackages and the setup file: install.ps1

Upload it to intune and specify the c:\spanishgames folder as the detection rule

That should be it
Hi Rudy,

If I have a ZIP file called Epic.zip (1.4GB) that I want to copy to C:\Temp then Extract on the target machine at C:\Epic would I be able to use this process above?
Hi, Yes you could but you need to add a powershell command to extract the zip file...

@Rudy_Ooms_MVP I tried to follow these steps and i just get a 0x80070001 error in Intune. from my trouble shooting it cant seem to find the files when trying to do the copy. Any ideas if i have missed something?

 
New-Item -Path "c:\" -Name "AskIT" -ItemType "directory" -force
Copy-Item -Path "askit\*" -Destination "C:\AskIT" -Recurse -force
 
Thanks for any help.
Hi,

Did you try to run the copy-item -path askit on the device itself? What happens?
Looking at the screenshot, could you change the install command to this. (change the scriptname to your scrptname)
powershell.exe -ExecutionPolicy Bypass -File .\Scriptname.ps1
It still fails. I am not sure how to run locally as there is no path for where the files are? If run locally the file path is not valid -Path "askit\*" as this run from the PowerShell root and not where the files are located?
If i edit the ps1 script with the full path locally then it works no issues but not sure what the path should be if the files are coming from Intune?

@Bapo16 

 

Hi, did you create a package as I mentioned?. So something like this. Inside the askit you deploy your files you want to copy

Rudy_Ooms_0-1634566578994.png

And convert that to a win32app... deploy that to intune.. When the file (zip win32) is downloaded it has also the askit folder in it

 

Like i am describing in this blog

Troubleshoot the Intune Win32 app deployment and the IMECache folder (call4cloud.nl)

 

@Rudy_Ooms_MVP Created the package as mentioned. I managed to run up another machine to test and found the issue is the Execution policy. For some reason the policy is not applying in the path mentioned. If i run a PowerShell before this script then it is working. 

 

Thanks for all your help thought. 

Hi,

Thats why you normally need to define this in the install parameters in the install part:
powershell.exe -ExecutionPolicy Bypass -File .\Scriptname.ps1
Hi Rudy,

If I wanted to put the folder into users documents how would I change the script to reflect any user that logs on devices the folder is installed on their own documents area?
could you show me the powershell script you have right now, so I can take a look at it and adjust where necessary

 New-Item -Path "c:\Documents\Studio one5\" -Name "Sounds" -ItemType "directory" -force

New-Item -Path "c:\Documents\Studio one5\" -Name "add ins" -ItemType "directory" -force

Copy-Item -Path "Studio one5\*" -Destination "C:\Documents\studio one5\" -Recurse -force 

There the locations however I also need to move the content into them via script

I want this to be in all users documents on each user account

Thanks in advanced
You could use a wildcard ?
> new-item -path c:\users\*\documents -name "Studio one5" -ItemType "directory" -force
copy-item "Studio one5\*" -Destination "C:\users\*\Documents\studio one5\" -

Hi @Rudy_Ooms_MVP 

 

I have tried the wild card "*" and I get errors: Screenshot 2022-07-20 at 1.20.02 PM.png

 

If I use "All Users" this gets the folder/content sent to the public documents rather than users documents

 

Any ideas?   

Hi @Rudy_Ooms_MVP 

 

It looks like it doesnt like the * for the destination part of the script

 

Screenshot 2022-07-20 at 1.31.56 PM.png

 

Screenshot 2022-07-20 at 1.33.37 PM.png

$Source = '.\studio one\*'
$Destination = 'C:\users\*\documents'
Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}