Deploy-Application.exe failing when trying to copy files and folders from the Installation Section of PSADT Package

I can run the .ps1 script and logic does what is expected but will not perform syntax correctly when running the .exe Posted script section, unable to figure out why the copy-item syntax is not copying the folders and files to the targeted locations using the .exe, however when using the .ps1 script works as expected.
[string]$installPhase = ‘Installation’

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
	## <Perform Installation tasks here>
     # New-Item -Path "C:\WorkflowEradication" -ItemType Directory
     Copy-Item -Path '.\Files\WorkflowEradication' -Destination 'C:\' -Recurse
     # Copy-Item -Path "$dirFiles\WorkflowEradication" -Destination "$envHomePath\" -Recurse -Force
     wscript.exe "c:\workfloweradication\qmon\setvar.vbs"
     Reg Import '.\Files\RegistryKeys\QMON.reg'

have you tried using the PSADT Copy-File function? here is an example for copying a folder:

Copy-File -Path "$dirFiles\client_1" -Destination "$envSystemDrive\oracle\product\11.2.0\" -Recurse

The $dirFiles variable is an internal variable that references the “Files” folder in PSADT. The internal PSADT functions will also write to the log automatically so you can see what is happening.

I recommended that you use the PSADT functions over PS cmdlets where ever possible. The internal functions just make your life easier.

Here is a link to the Function page Copy-File Function


Thank you @Willis_Spires great resolution and learning experience. Thank you for explaining in more detail as well :slight_smile:


I’m glad it helped. :grinning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.