VMware Cloud Community
neririn
Contributor
Contributor

Set-NetworkAdapter

Does anyone have a suggestion on a one-liner that would connect, and conversly disconnect, the network adapter for vm's matching a certain string? That is to say, I want to disconnect all the vm's in my envoirmnet that start with DR_. Any suggestions will be greatly appreciated.

Reply
0 Kudos
1 Reply
admin
Immortal
Immortal

Disconnect:

Get-VM DR* | Get-NetworkAdapter | Set-NetworkAdapter -connected:$false

Just switch $false to $true to reconnect.

=====

Carter Shanklin

Read the PowerCLI Blog
[Follow me on Twitter|http://twitter.com/cshanklin]

Reply
0 Kudos