Quantcast
Channel: Virtual Machine Manager – General forum
Viewing all articles
Browse latest Browse all 2770

cannot remove vmnetwork from virtualnetworkadapter from Powershell

$
0
0

Hi. In the VMM 2012 SP1 when you edit hardware properties of a VM, then go to a network adapter settings, you click Browse next to the VMNetwork selection - from there you can click a button to clear the VMNetwork selection/assignment, which makes the GUI show "Not specified" and it clears properties VMNetwork and LogicalNetwork of the network adapter.

I'm trying to achieve the same using Powershell. I've tried something like:

(get-vm "vm01").VirtualNetworkAdapters[0] | Set-SCVirtualNetworkAdapter -VMNetwork ""

I've also tried $null instead of "". but no go. Powershell complains about type mismatch:

Set-SCVirtualNetworkAdapter : Cannot bind parameter 'VMNetwork'. Cannot convert the "" value of type "System.String" to
 type "Microsoft.SystemCenter.VirtualMachineManager.VMNetwork".
At line:1 char:88
+ ... ter -VMNetwork ""
+                    ~~
    + CategoryInfo          : InvalidArgument: (:) [Set-SCVirtualNetworkAdapter], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.SetNICCmdlet

How can I achieve this from Powershell?

In case anyone wonders why I need to do this - I need to remove and remake the logical network, so I need to unassign it from all VMs. I can do this from GUI, but that's very slow with large number of VMs.



Viewing all articles
Browse latest Browse all 2770

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>