Quantcast
Viewing all articles
Browse latest Browse all 120

VMM – PowerShell oneliners to set VM Network Optimization (Part 2)

Some time ago I wrote a blog post PowerShell oneliner to enable VM Network Optimization in VMM

Last week I received a question about this post: Howto accomplish this on only VM’s on a specific cluster, or even a specific node.
So let’s start with the node since that’s the easy one.

To select all virtual machines on a node:

Get-VMHost -ComputerName HVC01N01 | Get-VM

And to enable the VM Network Optimzation on them:

Get-VMHost -ComputerName HVC01N01 | Get-VM | ForEach-Object { Set-VirtualNetworkAdapter -VMNetworkOptimizationEnabled $True }

But most clusters will consist of more than one node…
Executing a line for each cluster node? Well… there should be a more elegant way to accomplish that task.
And there is Image may be NSFW.
Clik here to view.
;-)

To select the cluster:

Get-VMHostCluster -Name HVC01

To select all nodes within that cluster:

Get-VMHostCluster -Name HVC01 | Get-VMHost

To select all VMs on a cluster:

Get-VMHostCluster -Name HVC01 | Get-VMHost | Get-VM

And of course to set the VM Network Optimization on all those VM’s:

Get-VMHostCluster -Name HVC01 | Get-VMHost | Get-VM | ForEach-Object { Set-VirtualNetworkAdapter -VMNetworkOptimizationEnabled $True }

Note how easy you can use the pipeline this way in order to go deeper from cluster to nodes to VM’s Image may be NSFW.
Clik here to view.
:-)

 


Viewing all articles
Browse latest Browse all 120

Trending Articles