I am designing TFS build definition to build solution on a build machine and publish files to posting server. I need to copy those publish files directly from build machine to posting server (which is a shared drive that i need to login using credentials).
Till now, we are posting the build results to a shared drive. I have used powershell commands to do this. From there, we are manually updating the files in posting server. Now i am trying to post directly to posting server rather than involving the manual process.
I need a powershell script to
I have got the script to everything except including user credentials to login to the destinationpath. I am trying to find some arguments to include login username and password for this destination path, but could not found anything appropriate.
Can this be done using MS Build Arguments instead of script?
Copy a file to a remote computer:
$Session = New-PSSession -ComputerName "Server01" -Credential "Contoso\PattiFul"
Copy-Item "D:\Folder001\test.log" -Destination "C:\Folder001_Copy\" -ToSession $Session
Once you type a user name, you will be prompted for a password.