Configuration - Software Deployment package, Pre-deployment uninstall existing package, Post-deployment copy file into user AppData path

Configuration - Software Deployment package, Pre-deployment uninstall existing package, Post-deployment copy file into user AppData path

Hi,

I need to copy a configuration file into the users profile paths for all users Post-Deploy.
  1. Install application using Desktop Central
  2. Copy ConfigFile.xml to all user profile folders after install is complete
I have tried a few PowerShell script options to copy the file from the Desktop Central path to all the user profile folders %LOCALAPPDATA%\New Application\Folder\ConfigFile.xml
The paths for "\New Application\Folder\" do not exist.
So I need to create the directory structure and copy the file after the install completes.

Could someone give me a hand with the PowerShell script?

I was trying to use Split-Path to find the location of the ConfigFile.xml.
But then I want to only copy the XML file to all of the User Profile paths "AppData\Local\Application\Folder\" the path does not exist so need to be created before copying the file.

Source
  • \Path
    • Script
    • ConfigFile.xml
    • File 2
Destination
  • C:\Users\*\AppData\Local\Application\Folder\
  1. #Declare location of the XML file using spli-path. Copy XML file to all user %LOCALAPPDATA% paths and create folder structure
  2.     $scriptPath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
  3.     $Source = Join-Path $scriptPath 'ConfigFile.ps1'
  4.     $Destination = 'C:\users\*\AppData\Local\Application\Folder\'
  5.     Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}
  6.     Exit $LASTEXITCODE

Thank you so much.

                New to ADSelfService Plus?