32 or 64 bit version of product: 64bit
Operating system: Windows Server 2016 (1607)
32 or 64 bit OS: 64bit
PS Engine: V5 - 64bit elevated with STA mode
I'm building a bunch of tools to simplify adding the whole network shebang for new subnets in SCVMM.
Code: Select all
$SCVMMServer = "fqdn.of.scvmm.server"
$LogicalNetwork = Get-SCLogicalNetwork -VMMServer $SCVMMServer -Name "INU-Datacenter_WORKNetwork"
$LogicalNetworkDefinition = Get-SCLogicalNetworkDefinition -VMMServer $SCVMMServer -LogicalNetwork $LogicalNetwork -Name "INTEGRATION"
$allSubnetVlans = $LogicalNetworkDefinition.SubnetVLans
$newSubnetVLAN = New-SCSubnetVLan -VMMServer $SCVMMServer -Subnet "172.10.10.0/24" -VLanID "400"
$allSubnetVlans += $newSubnetVLAN
Set-SCLogicalNetworkDefinition -VMMServer $SCVMMServer -LogicalNetworkDefinition $LogicalNetworkDefinition -SubnetVLan $allSubnetVlans # this freezes
Write-Host "this will never be reached in a form"
Running this as a regular script (PS ISE or PSS) works as expected and the Write-Host will be displayed.
When run from a PSS form project, it will add the Subnet/Vlan to the network definition, but then freeze instead of continuing to the next line of code. This happens both from inside the PSS and after compiling.