2017-12-13 7 views
1

VSOの「ターゲットマシン上のPower Shell」ステップは、ステップが完了した後にのみログを表示しています。このステップが実行されている間にログを見る方法はありますか? 「書き込み詳細」メモは、ステップが完了した後にのみ表示されます。VSOのターゲットマシン上の電源シェル

答えて

0

内蔵PowerShell on target machineタスクでは、リモートスクリプトの実行中にログを取得できません。

ソースコード:

$p=ConvertTo-SecureString "password" -AsPlainText -Force 
$mc=New-Object System.Management.Automation.PSCredential("username",$p) 
Invoke-Command -ComputerName [machine] -FilePath "hello.ps1" -Credential $mc 

$deploymentResponse = Invoke-Command -ScriptBlock $RunPowershellJob -ArgumentList $machine, $scriptPath, $resourceProperties.winrmPort, $scriptArguments, $initializationScriptPath, $resourceProperties.credential, $resourceProperties.protocolOption, $resourceProperties.skipCACheckOption, $enableDetailedLoggingString, $sessionVariables, $PSScriptRoot 
    Write-ResponseLogs -operationName $deploymentOperation -fqdn $displayName -deploymentResponse $deploymentResponse 

#################################################### 

$job = Start-Job -ScriptBlock $RunPowershellJob -ArgumentList $machine, $scriptPath, $resourceProperties.winrmPort, $scriptArguments, $initializationScriptPath, $resourceProperties.credential, $resourceProperties.protocolOption, $resourceProperties.skipCACheckOption, $enableDetailedLoggingString, $sessionVariables, $PSScriptRoot 
$Jobs.Add($job.Id, $resourceProperties) 
... 
Write-ResponseLogs -operationName $deploymentOperation -fqdn $displayName -deploymentResponse $output 

回避策は、PowerShellのを通じてタスクをInvoke-Commandコマンドを呼び出すことができるということです