0
스크립트 블록을 취하는 시간 (원격 실행)을 측정해야합니다. 그것에 대해
http://powershell.com/cs/blogs/tips/archive/2012/06/19/check-powershell-speed.aspxPowershell을 사용하여 Invoke-Command 측정
$timespan = Measure-Command $code
"Your code took {0:0.000} seconds to run" -f $timespan.TotalSeconds
어떤 제안 : 나는 이런 식으로 뭔가를하고 싶은
try
{
Invoke-Command -credential $testCred -computer $ServerName -scriptblock {
param([String]$scriptDeploy, [String]$destino) &"$scriptDeploy" 'parametro1' $destino
$ScriptBlockOutput = $Error
} -ArgumentList $RutaRemotaParaScriptDeInstalacion, "$dirRemotoDestino"
"`r`n`r`nOK para script de despliegue"
exit 0;
}
catch
{
"`r`n`r`nError en script de despliegue"
"`r`nError in " + $_.InvocationInfo.ScriptName + " at line: " + $_.InvocationInfo.ScriptLineNumber + ", offset: " + $_.InvocationInfo.OffsetInLine + ".";
exit -1
}
:
이 내 코드?
UPDATE : 내 솔루션
$timespan = Measure-Command -Expression {
Invoke-Command -credential $testCred -computer $ServerName -scriptblock {
param([String]$scriptDeploy, [String]$destino) &"$scriptDeploy" 'parametro1' $destino
$ScriptBlockOutput = $Error
} -ArgumentList $RutaRemotaParaScriptDeInstalacion, "$dirRemotoDestino"
}
"`r`n`r`nScript ha tardado {0:0.000} segundos en ejectuarse" -f $timespan.TotalSeconds
http://powershell.com/cs/blogs/tips/archive/2012/06/19/check-powershell-speed.aspx –