Forum Discussion
Werner2024
Jan 25, 2024Copper Contributor
Intune
good day Hope someone can assist me, I want to create a intune package that copy a folder from a network server to the local C drive of the computer, after the copy has finish I want it to automat...
JosvanderVaart
Jan 25, 2024Iron Contributor
Werner2024 These steps can be achieved with a powershell script that you can package as intunewin and then deploy as an app. Are you already doing these steps? If so, can you share the script with us?
- Werner2024Jan 25, 2024Copper ContributorHi Jos van der Vaart
Thanks you for the reply, here is the script i am using noe, might not be the best but it works if you run it on the machine self, but not trough Intune
$sourceFolderPath = " # Specify the network path to the shared folder
$destinationFolderPath = # Specify the local destination path on your laptop
$softwarelocation =
#Write-Host $destinationFolderPath
#Write-Host $sourceFolderPath
# Create the destination folder if it does not exist
if (-not (Test-Path -Path ${destinationFolderPath})) {
try {
New-Item -ItemType Directory -Path ${destinationFolderPath} -ErrorAction Stop
Write-Host "Folder created at ${destinationFolderPath}"
}
catch {
Write-Host "Error creating folder: ${destinationFolderPath}"
return
}
}
else {
#Write-Host "Destination folder already exists."
}
# Use xcopy to copy files from the shared folder to the local destination
try{
$xcopyCommand = "Copy-Item -Path "File Location" -Destination C:\ -Recurse"
Invoke-Expression -Command $xcopyCommand
Write-Host "Files copied from ${sourceFolderPath} to ${destinationFolderPath}."
}
catch {
Write-Host "Error copying files: $_"
}
#Wait for 15 seconds
Start-Sleep -Milliseconds 15000
cd $softwarelocation
Start-Process -FilePath .\ "Install file"-ArgumentList "/S" -Wait- JosvanderVaartJan 25, 2024Iron ContributorHi Werner,
Thanks for sharing, but how do you roll out this script through Intune. Is this through an app or a script? I would advise you to at least roll it out as an app.- Werner2024Jan 25, 2024Copper ContributorI have a poweshell script that I have build an .intunewin package, then from there I upload into Intune as an Windows app (Win32) app to deploy.
- TimBoschJan 25, 2024Brass ContributorHey Werner, Thanks for sharing.
Have you tried running it locally and could you share a anonimised error log?
it looks like that you also install it in the same script.
Maybe it's easier to use a .zip containing the set of files, copying it over and using unzip archive command to achieve easier copying to the folder you want,
Expand-Archive -LiteralPath <PathToZipFile> -DestinationPath <PathToDestination>
I have done this due to an AX installation and used a zip to move the 4gb big file towards a temp folder on the endpoint, then unzipping it and using the install script to install it.- Werner2024Jan 25, 2024Copper ContributorHi Tim,
Thanks for the info will definitely give it a try, my only concern is the copy process from the server to the local machine does not happen, so I am stuck there.
The error logs does not give me any error's or false status, the app show installed on Intune console but on the endpoint nothing is happening. what I have notice is that it shows that the app is downloading and installing then a min after that it fails.