How can I wrap this Powershell cmdlet into a timeout function?
问题 I've tried (and failed) to get [System.Delegate]::CreateDelegate( to work, New-Object [System.Threading.Tasks.Task]::Run(, to work, Start-Job with Wait-Job, Powershell does not seem to be setup to do an asynchronous task with a wait timeout? If anyone has any ideas, that'd be awesome. do { Sleep 2; $testShare = Test-Path "\\$server\c$"; Write-Host "Share availability is:" $testShare; }while($testShare -eq $true) # wait for the share to become unavailable Adams suggestion do { Sleep 1; #