Hi,
I need to copy a configuration file into the users profile paths for all users Post-Deploy.
- Install application using Desktop Central
- 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\
- #Declare location of the XML file using spli-path. Copy XML file to all user %LOCALAPPDATA% paths and create folder structure
- $scriptPath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
- $Source = Join-Path $scriptPath 'ConfigFile.ps1'
- $Destination = 'C:\users\*\AppData\Local\Application\Folder\'
- Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}
- Exit $LASTEXITCODE
Thank you so much.