Copy file and service stopped not working

Hi all,

I’m trying to install checkpoint. However, before the install, I need to copy a file out of the program files and then back in. also I have a new file that I need to copy over.
for some reason, it all fails. my understanding is when you copy the files if the folder doesn’t exist it creates it. However, I tried that and it didn’t work. then I tried to create the folder and still nothing.
on top of that when I tried to copy the file over that I have that one doesnt work eaither.
any help greatly appreciated.

	If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
		##*===============================================
		##* PRE-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Installation'

		## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
		Show-InstallationWelcome -CloseApps 'TrGUI' -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt

		## Show Progress Message (with the default message)
		Show-InstallationProgress -StatusMessage "Installing $installTitle. Please Wait..."
 
		## <Perform Pre-Installation tasks here>
        Stop-ServiceAndDependencies -Name 'EPWD'
        Stop-ServiceAndDependencies -Name 'TracSrvWrapper'
        New-Folder -Path "$envTEMP\Checkpoint"
        Copy-File -Path "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config" -Destination "C:\TEMP\CheckPoint\Trac.config"
        Copy-File -Path "$dirSupportFiles\TRAC\*.*" -Destination "$envTemp\tempfiles\CheckPoint"

		##*===============================================
		##* INSTALLATION
		##*===============================================
		[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>
        Execute-MSI -Action 'Install' -Path "Checkpoint_VPN_Client_E82-40.msi"


		##*===============================================
		##* POST-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Installation'

		## <Perform Post-Installation tasks here>

        Stop-ServiceAndDependencies -Name 'EPWD'
        Stop-ServiceAndDependencies -Name 'TracSrvWrapper'
        Copy-File -Path "C:\TEMP\CheckPoint\Trac.config" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config"
        Stop-ServiceAndDependencies -Name 'EPWD'
        Stop-ServiceAndDependencies -Name 'TracSrvWrapper'
        Copy-File -Path "$dirSupportFiles\trac.defaults" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\trac.defaults"
        Start-ServiceAndDependencies -Name 'EPWD'
        Start-ServiceAndDependencies -Name 'TracSrvWrapper'

		## Display a message at the end of the install
		If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Checkpoint Upgrade compleated.' -ButtonRightText 'OK' -Icon Information -NoWait }
	}
Copy-File -Path "C:\TEMP\CheckPoint\Trac.config\*" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config"

Copy-File -Path "$dirSupportFiles\trac.defaults\*" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\trac.defaults"

thank you maarten. that didnt work. I really want to use this tool. but copying files should not be a complicated task.

In the folders Trac.config and trac.defaults  are located anyway files?
I have run copy-file on an test machine 
Copy-File -Path "C:\TEMP\CheckPoint\Trac.config\*" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config"

Copy-File -Path "$dirSupportFiles\trac.defaults\*" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\trac.defaults"

Can you send me de log

________________________________________
F.y.i part of the log 
|[Installation] :: Copy file in path [C:\TEMP\CheckPoint\Trac.config\*] to destination [C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config].
|[Installation] :: File copy completed successfully.
|[Installation] :: Copy file in path [C:\SCCM\20.2.0.25\SupportFiles\trac.defaults\*] to destination [C:\Program Files (x86)\CheckPoint\Endpoint Connect\trac.defaults].
|[Installation] :: File copy completed successfully.
Sorry, I missed the first part of your script


Copy-File -Path "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config\*" -Recurse  -Destination "C:\TEMP\CheckPoint\Trac.config"
		Copy-File -Path "$dirSupportFiles\TRAC\*" -Recurse -Destination "$envTemp\tempfiles\CheckPoint"

Copy-File -Path "C:\TEMP\CheckPoint\Trac.config\*" -Recurse -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config"
		Copy-File -Path "$dirSupportFiles\trac.defaults\*" -Recurse -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\trac.defaults"

Im sorry for the confusion the trac.config and trac.defaults are files not folders.
I’m still learning this tool. how didi you get the tool to show you a log. or where do Ic heck for it.

I will try with the -recurse see if it helps

The entire point of Copy-File function is to create a folder path for you. It is a wrapper for Copy-Item -Force

Update:
The log – c:\windows\logs\software

Copy-File -Path "C:\Program Files (x86)\CheckPoint\Endpoint Connect\Trac.config" -Destination "C:\TEMP\CheckPoint\"
 Copy-File -Path "$dirSupportFiles\TRAC\*" -Recurse -Destination "$env:Temp\tempfiles\CheckPoint\"
		
		
		
Copy-File -Path "C:\TEMP\CheckPoint\Trac.config" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\"
Copy-File -Path "$dirSupportFiles\trac.defaults" -Destination "C:\Program Files (x86)\CheckPoint\Endpoint Connect\"
1 Like