During Octopus deployment, I have a PS script step which used to create a new file in primary server folder. I want to copy the same file to secondary server.
We tried with different ways… nothing helping
$Session = New-PSSession -ComputerName “Server01” -Credential “****”
Copy-Item “D:\Folder001\test.log” -Destination “C:\Folder001_Copy” -ToSession $Session
Thanks for getting in touch! I think the easiest option would be to run the same script that creates the file on the second server as well as the first to ensure it then exists on both. This can be done by targeting your script step to a role that exists on both servers. Would that accomplish what you’re after?
Please let me know if I’m misunderstanding any details, and don’t hesitate to reach out if you have any further questions.
Thank You for your help.
The file content should be common for both servers, so cannot create a new copy in secondary server.
Thanks for following up! Another potential option would be use the
New-OctopusArtifact PowerShell CmdLet to collect files from remote machines and copy them to the Octopus Server. You can read more info about it in our docs.
Would this be option for you? Let me know what you think or if you have any further questions going forward.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.