Functions/Start-JTGateway.ps1
function Start-JTGateway { [CmdletBinding()] param ( [Parameter()] [switch] $Wait ) $GatewayVM = "JT-Gateway2" if (((Get-VM $GatewayVM).State) -ne "Running") { Start-VM $GatewayVM -AsJob if ($Wait) { while (!(Get-VMNetworkAdapter $GatewayVM | Where-Object IPAddresses)) { Start-Sleep 2 } } } else { Write-Warning "$GatewayVM already running" } } |