i would like to do following :
1. start 3 timers at once
2. first timer checks for network
3. 2nd renames the computer
3. 3rd one should execute code only after the 1st and 2nd timer ends
i have following code :
Code: Select all
$timerRenamePC_Tick = {
if ($timerRenamePC.Tag -ne $null)
{
if ($timerRenamePC.Tag.state -ne 'Running')
{
$label_FinalComputerName.Text = Receive-Job -Name 'RenamePC' -Keep
$script:NewDomainComputerName = $label_FinalComputerName.Text
search-domaincomputer -NewDomainComputerName $NewDomainComputerName -FQDN $FQDN
$timerRenamePC.Tag = $null
$timerRenamePC.Stop
}
else
{
}
}
}
Code: Select all
( ($timerNetworkCheck.Tag.state -ne 'Running') -and ($timerRename.Tag.state -ne 'Running') )
I do not want to do it via job tracker, as codeblocks there does not allow me to handle certain situations. The above is just and example, in real world i have much more timers running concurrently but need to wait for each other.
Any idea if this can be achieve via simple timers ?
thanks a lot