I've encountered an issue where the content is successfully downloaded to the ccmcache folder, but it fails to copy to the destination folder when deployed via SCCM. The deployment is targeted to run under the system context and is configured to run with administrator privileges. However, when I execute the same script manually as an administrator, it works as expected. Can someone assist with troubleshooting this?
Im using the below powershell script
# Define the source path of the template and the destination path on client machines
$templateSource = "\\Network path\ PPT Template.pptx"
$templateDestination = "C:\ProgramData\Microsoft\Templates\ PPT Template.pptx"
try {
# Check if the destination directory exists, if not, create it
if (-Not (Test-Path "C:\ProgramData\Microsoft\Templates")) {
New-Item -Path "C:\ProgramData\Microsoft\Templates" -ItemType Directory
}
# Copy the template from the source to the destination
Copy-Item -Path $templateSource -Destination $templateDestination -Force
# Verify if the file was copied successfully
if (Test-Path $templateDestination) {
Write-Output "Template copied successfully to $templateDestination"
} else {
Write-Error "Failed to copy the template."
}
} catch {
Write-Error "An error occurred: $_"
}
Im using the below powershell script
# Define the source path of the template and the destination path on client machines
$templateSource = "\\Network path\ PPT Template.pptx"
$templateDestination = "C:\ProgramData\Microsoft\Templates\ PPT Template.pptx"
try {
# Check if the destination directory exists, if not, create it
if (-Not (Test-Path "C:\ProgramData\Microsoft\Templates")) {
New-Item -Path "C:\ProgramData\Microsoft\Templates" -ItemType Directory
}
# Copy the template from the source to the destination
Copy-Item -Path $templateSource -Destination $templateDestination -Force
# Verify if the file was copied successfully
if (Test-Path $templateDestination) {
Write-Output "Template copied successfully to $templateDestination"
} else {
Write-Error "Failed to copy the template."
}
} catch {
Write-Error "An error occurred: $_"
}