We needed to copy some simple license files to a directory on intune managed devices.
First I used a standard xcopy in a .bat file but this was not working for the full 100% so I switched to a powershell script.
Then packed this script in an intunewim file an deploy this via Intune Win32 app.
I must admit that I did not made the script but can’t remember the source so can not give credits to the creator.
The origin source can be found here: (thanks Robson) https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Intune/Win32AppToCopyFiles/Install.ps1
I used this code.
$LogFile = "C:\Windows\Temp\license-copy.log"
$TargetFolder = "C:\Program Files\Spatial\Licenses"
$SourceFolder = $PSScriptRoot
# Delete any existing logfile if it exists
If (Test-Path $LogFile){Remove-Item $LogFile -Force -ErrorAction SilentlyContinue -Confirm:$false}
Function Write-Log{
param (
[Parameter(Mandatory = $true)]
[string]$Message
)
$TimeGenerated = $(Get-Date -UFormat "%D %T")
$Line = "$TimeGenerated : $Message"
Add-Content -Value $Line -Path $LogFile -Encoding Ascii
}
Write-Log "Starting the copy of license file"
# Make sure target folder exists
If (!(Test-Path $TargetFolder)){
Write-Log "Target folder $TargetFolder does not exist, creating it"
New-Item -Path $TargetFolder -ItemType Directory -Force
}
# Copy the files
Write-Log "About to copy contents from $SourceFolder to $TargetFolder"
try {
Copy-Item -Path "$SourceFolder\*" -Destination $TargetFolder -Recurse -Force -ErrorAction Stop
Write-Log "Contents of $SourceFolder successfully copied to $TargetFolder"
}
catch {
Write-Log "Failed to copy $SourceFolder to $TargetFolder. Error is: $($_.Exception.Message))"
}
Download IntuneWinAppUtil, GitHub – microsoft/Microsoft-Win32-Content-Prep-Tool: A tool to wrap Win32 App and then it can be uploaded to Intune
Create a version.txt file which we use as detection file.
Create a install.ps1 file with the powershell code from above.
Create Directory structure :
\IN
\OUT
\Source
Place all the necessary files including the powershell script and version.txt in the \IN directory
Now use Powershell to create IntuneWin application with the IntuneWinAppUtil.
.\IntuneWinAppUtil -c C:\IntuneWin\IN -s C:\IntuneWin\IN\install.ps1 -o C:\IntuneWin\OUT
Now Create an Win32 application and upload the file to Intune
Install command | powershell.exe -ExecutionPolicy Bypass -File Install.ps1 |
Uninstall command | powershell.exe -ExecutionPolicy Bypass -File Uninstall.ps1 |
Detection rules | File C:\Program Files\Spatial\Licenses |

i think here is the creator:
https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Intune/Win32AppToCopyFiles/Install.ps1