Вы можете добавить таймер / событие в вашей команде. Ниже приведен пример самодействующего скрипта
$timer = New-Object timers.timer
$timer.Interval = 10000 # milliseconds
Register-ObjectEvent -InputObject $timer -EventName Elapsed -SourceIdentifier Timer.Output -Action {Write-Host "Timeout!"; Stop-Process $pid}
$timer.Enabled = $true
# do something
while ($true) {
sleep 1
Write-Host (get-date)
}