Created
July 2, 2019 15:12
Star
You must be signed in to star a gist
PowerShell function to wait for an async task to complete and return the result when completed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-AsyncResult { | |
[CmdletBinding()] | |
[OutputType('Object')] | |
param ( | |
[Parameter(Mandatory = $true, Position = 1)] | |
[object] $Task | |
) | |
Write-PSFMessage -Level Verbose -Message "Building the Task Waiter and start waiting." -Target $Task | |
$Task.GetAwaiter().GetResult() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment