tectrack.net
  • Home
  • Cloud
    • AWS
    • Google Cloud
  • Virtualization
    • VMWare
  • Containers
    • Kubernetes
  • Other
No Result
View All Result
tectrack.net
  • Home
  • Cloud
    • AWS
    • Google Cloud
  • Virtualization
    • VMWare
  • Containers
    • Kubernetes
  • Other
No Result
View All Result
tectrack.net
No Result
View All Result

List Portgroups and IP address of VMs using PowerCLI

Geeth Nuwan by Geeth Nuwan
July 16, 2023
in VMWare, PowerCLI, Scripting, Virtualization
Reading Time: 2 mins read
453 5
A A
1
List Portgroups and IP address of VMs using PowerCLI
Share on FacebookShare on TwitterShare on LinkedIn

For official work, I wanted to print out a list of all the VMs and their associated network/portgroups and IP details. since I am dealing with thousands of VMs this was a difficult task to perform manually. I was searching and trying to write a script to get the expected result. Finally, To get this info I ran the following command:

Get-DataCenter DataCenterName | Get-VM | Get-NetworkAdapter | Select-Object @{N="VM";E={$_.Parent.Name}},@{N="NIC";E={$_.Name}},@{N="Network";E={$_.NetworkName}}

But what I expected it to run get the output based on the cluster. therefore modified the command as follows

You might also like

How to Fix ESXi “MetadataDownloadError Could not download from depot” Error during Upgrades/Patching.

How to Fix “MetadataDownloadError Could not download from depot” Error when Upgrades/Patching VMWare ESXi.

July 11, 2023
Cross vCenter VM Migration Using xVMotion Tool | Step by Step Guide

Cross vCenter VM Migration Using xVMotion Tool | Step by Step Guide

March 30, 2023

Get-Cluster ClusterName | Get-VM | Get-NetworkAdapter | Select-Object @{N="VM";E={$_.Parent.Name}},@{N="NIC";E={$_.Name}},@{N="Network";E={$_.NetworkName}}

This gave me a nice output.

But that was not enough, the requirement was to retrieve the IP addresses. For this, I used the below script to take the result.

-
Get-Cluster ClusterName | Get-VM | Select-Object -Property Name,@Name='IPAddress';Expression={($_ | Get-VMGuest).IPAddress}},@Name='NetworkName';Expression={($_ | Get-NetworkAdapter).NetworkName}}

Added the following at the end of the script to get the output to a CSV file.

 | Export-Csv c:\geethvmlist.csv

.

Tags: PowerCLIScripts
Share254Tweet159Pin57Share44
Geeth Nuwan

Geeth Nuwan

I am a Systems Engineer by profession. Also enthusiastic IT professional specializing in Virtualization, Cloud technologies and enterprise infrastructure.

Related Stories

How to Fix ESXi “MetadataDownloadError Could not download from depot” Error during Upgrades/Patching.

How to Fix “MetadataDownloadError Could not download from depot” Error when Upgrades/Patching VMWare ESXi.

by Geeth Nuwan
July 11, 2023
1

Upgrading VMware ESXi is a critical task in maintaining a virtualized environment. However, sometimes errors can occur during the upgrade...

Cross vCenter VM Migration Using xVMotion Tool | Step by Step Guide

Cross vCenter VM Migration Using xVMotion Tool | Step by Step Guide

by Geeth Nuwan
March 30, 2023
0

VMWare has introduced a fling to migrate VMs between two vCenters graphically. What is Cross vCenter Workload Migration Utility (xVMotion)...

[Fixed] Raw Device Mapping (RDM) Missing from a Windows VM

[Fixed] Raw Device Mapping (RDM) Missing from a Windows VM

by Geeth Nuwan
March 30, 2023
0

Image from - http://www.electricmonk.org.uk/2012/03/02/vmware-rdms/ Raw device mapping (RDM) is a method to provide direct access to a LUN on an...

Comments 1

  1. iloveroom says:
    2 years ago

    I was excited to uncover this great site. I need to to thank you for your time for this particularly wonderful read!! I definitely enjoyed every part of it and I have you book marked to check out new stuff in your web site.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

How I Passed LFCS (Linux Foundation Certified System Administrator). 10 Tips and Tricks to Pass LFCS

How I Passed LFCS (Linux Foundation Certified System Administrator). 10 Tips and Tricks to Pass LFCS

July 12, 2023
List Portgroups and IP address of VMs using PowerCLI

List Portgroups and IP address of VMs using PowerCLI

July 16, 2023

Popular Story

  • How to Fix ESXi “MetadataDownloadError Could not download from depot” Error during Upgrades/Patching.

    How to Fix “MetadataDownloadError Could not download from depot” Error when Upgrades/Patching VMWare ESXi.

    1441 shares
    Share 576 Tweet 360
  • How I Passed LFCS (Linux Foundation Certified System Administrator). 10 Tips and Tricks to Pass LFCS

    814 shares
    Share 324 Tweet 203
  • Cross vCenter VM Migration Using xVMotion Tool | Step by Step Guide

    719 shares
    Share 288 Tweet 180
  • How to Point Cloudflare Registered Domain Name to your Web Hosting / cPanel account

    638 shares
    Share 255 Tweet 160
  • List Portgroups and IP address of VMs using PowerCLI

    634 shares
    Share 254 Tweet 159

Expert insights from Virtualization to cloud-native technologies

Categories

  • Certifications
  • Containers
  • How To
  • Kubernetes
  • Linux
  • PowerCLI
  • Scripting
  • Storage
  • Virtualization
  • VMWare

Pages

  • About
  • Contact
  • Home
  • Privacy Policy

The views and comments expressed anywhere on this site are strictly mine and not the opinions and views of my employer. [more]
  • Sponsor
  • Terms and Conditions
  • Privacy Policy
  • Contact Us

© 2023 tectrack.net

No Result
View All Result
  • About
  • Contact
  • Become Sponsor
  • Privacy Policy
  • Disclaimer

© 2023 tectrack.net

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.