Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created February 25, 2017 09:13
Show Gist options
  • Save SteveGilham/7807af17011094cef9edecad21abf5c9 to your computer and use it in GitHub Desktop.
Save SteveGilham/7807af17011094cef9edecad21abf5c9 to your computer and use it in GitHub Desktop.
Start-Transcript
$pool = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool(1,1)
$save = [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace
try {
[System.Management.Automation.Runspaces.Runspace]::DefaultRunspace = $null
$pool.Open()
# do stuff...
$pool.Close()
# do more stuff...
}
finally {
[System.Management.Automation.Runspaces.Runspace]::DefaultRunspace = $save
}
Stop-Transcript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment