خرید بک لینک

Vote count: 0

I have Powershell Script with workflow and foreach -parallel

I set TimeoutSec inside workflow to InlineScript

When I set sleep command to 15 sec, I got error below:

Microsoft.PowerShell.UtilityWrite-Error : The activity has exceeded the specified maximum ruing time of 10 seconds. At create-new-vms:25 char:25 + + CategoryInfo : NotSpecified: (:) [Write-Error], TimeoutException + FullyQualifiedErrorId : System.TimeoutException,Microsoft.PowerShell.Commands.WriteErrorCommand + PSComputerName : [localhost] Microsoft.PowerShell.UtilityWrite-Error : The activity has exceeded the specified maximum ruing time of 10 seconds. At create-new-vms:25 char:25 + + CategoryInfo : NotSpecified: (:) [Write-Error], TimeoutException + FullyQualifiedErrorId : System.TimeoutException,Microsoft.PowerShell.Commands.WriteErrorCommand + PSComputerName : [localhost]

I want write this error to Log files (one file to one error? for every foreach element )

How to do this?

What I must add to my script?

My script:

$newvmlist="test1","test2"

workflow create-new-vms {

param(
[string[]]$vms
)

foreach -parallel ($vm in $vms)
{

$run = InlineScript{


# Create New VM
echo " "
echo " "
echo "___"
echo "VM Name - $Using:vm " 
echo "----"
echo " "
echo " "
sleep 15


} -PSActionRuingTimeoutSec 10 


$run 


}

}

create-new-vms -vms $newvmlist 

Thanks in advance!

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 20 خرداد 1395 ساعت: 17:03

صفحه بندی