sbdevman / Vsts

3 stars 4 forks source link

RemoteCopy Parallel on two machines #2

Closed Shortcheese closed 5 years ago

Shortcheese commented 7 years ago

I would like to use the RemoteCopy setting up a copy action on more than one server in a enviroment. I first use the normal windows machine file copy but that is from buildserver towards enviroment machine . So the source is not on the remote machine and using a unc path is not compatible withe multiple servers.

But when I use this extension I get the error below: 2017-03-07T12:56:39.2272207Z C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; $env:TF_BUILD = 'True' ; Import-Module -Name 'D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'Continue' ; $DebugPreference = 'Continue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\RemoteCopy.ps1'''))" 2017-03-07T12:56:40.0579671Z ##[debug]VstsTaskSdk 0.8.1 commit 2017-03-07T12:56:40.1048453Z ##[debug]Entering D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\RemoteCopy.ps1. 2017-03-07T12:56:40.1360951Z ##[debug]INPUT_REMOTECOMPUTER: 'server1,server2' 2017-03-07T12:56:40.1360951Z ##[debug]INPUT_USERNAME: '' 2017-03-07T12:56:40.1360951Z ##[debug]INPUT_PASSWORD: '****' 2017-03-07T12:56:40.1517187Z ##[debug]INPUT_SOURCE: 'd:\Inetpub 2017-03-07T12:56:40.1517187Z ##[debug]INPUT_DESTINATION: 'd:\backup\2017.02.14.1' 2017-03-07T12:56:40.1517187Z ##[debug]INPUT_MOVE: 'false' 2017-03-07T12:56:40.1517187Z ##[debug]INPUT_CLEAN: 'false' 2017-03-07T12:56:40.2610970Z ##[debug]Leaving D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\RemoteCopy.ps1. 2017-03-07T12:56:40.2610970Z ##[debug]Caught exception from task script. 2017-03-07T12:56:40.2610970Z ##[debug]Error record: 2017-03-07T12:56:40.3079723Z ##[debug]New-PSSession : One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects instead of strings. 2017-03-07T12:56:40.3235971Z ##[debug]At D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\RemoteCopy.ps1:36 char:16 2017-03-07T12:56:40.3235971Z ##[debug]+ $session = New-PSSession -ComputerName $RemoteComputer -Credential $credenti ... 2017-03-07T12:56:40.3235971Z ##[debug]+ ~~~~~~~~~~~~~ 2017-03-07T12:56:40.3235971Z ##[debug] + CategoryInfo : InvalidArgument: (System.String[]:String[]) [New-PSSession], ArgumentException 2017-03-07T12:56:40.3235971Z ##[debug] + FullyQualifiedErrorId : PSSessionInvalidComputerName,Microsoft.PowerShell.Commands.NewPSSessionCommand 2017-03-07T12:56:40.3235971Z ##[debug] 2017-03-07T12:56:40.3235971Z ##[debug]Script stack trace: 2017-03-07T12:56:40.3235971Z ##[debug]at , D:\Agents\Agent02\tasks\RemoteCopy\1.0.0\RemoteCopy.ps1: line 36 2017-03-07T12:56:40.3235971Z ##[debug]at , : line 1 2017-03-07T12:56:40.3235971Z ##[debug]at , : line 22 2017-03-07T12:56:40.3235971Z ##[debug]at , : line 18 2017-03-07T12:56:40.3235971Z ##[debug]at , : line 1 2017-03-07T12:56:40.3392262Z ##[debug]Exception: 2017-03-07T12:56:40.3392262Z ##[debug]System.ArgumentException: One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects instead of strings. 2017-03-07T12:56:40.3392262Z ##[debug] at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord) 2017-03-07T12:56:40.3704709Z ##[error]One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects instead of strings.

sbdevman commented 7 years ago

Hi , Thank you for your opinion , I think I must be change it that support your demanded .