1 Day Left – The Most Awesome PowerShell One-Liner in the History of PowerShell One-Liners!

get-datacenter MyVC | get-vm | Get-NetworkAdapter | Where-Object { $_.Name -like "*1"} | Set-NetworkAdapter -NetworkName NotThatNetwork -Confirm:$false

So, say you provision all of your VM’s on one host, with one set of networks, that is completely removed from the remainder of your infrastructure. You then Cold-Migrate the new VM’s to their new homes. You now need to chance the network names to match. What you say? You have a dozen, a hundred of them to change? The above PowerShell one-liner will take care of all of that for you.

Questions? Comments? Leave em in the comments.

One thought on “1 Day Left – The Most Awesome PowerShell One-Liner in the History of PowerShell One-Liners!”

  • Pingback: Changing vNIC Port Group Assignment in VMware with PowerShell « H9Newser’s Blog

Comments are closed.