top of page

TechBobbles

tech logo with triangle shape.jpg
Writer's pictureAdmin

How to collect data store (device and paths) details using PowerCLI




For those working in a VMware environment with more than 1000 ESXi hosts, managing and making changes to each ESXi host without any automation can be very difficult. Fortunately, PowerCLI enables us to automate various vCenter tasks. In this discussion, I will explain how to retrieve storage details from vCenter and compile them into a single report.


This script is going to provide the below details:

  • vCenter Name

  • Runtime Name

  • UUID

  • Datastore Name

  • RDM VMs

  • Path Count

  • Dead/Inactive Path Count

  • Vendor

  • Capacity in GB

  • Multipath Policy

  • VMhost

  • IS Local storage

  • Operational State

  • Storage Model

This report can help you to do multipath checking in multiple clusters or vCenter. But it requires an input csv file(name- input_file.csv) in d: drive to take the input. Please find the input file format.


Steps performed in the script:

  1. Get the input details from the CSV file

  2. Login to vCenter

  3. Get all the data store details from the respective ESXi

  4. Get all the VMs details connected with RDMs with their UUID

  5. Get all the SCSI Lun details

  6. Get all the LUN path details

  7. Keep all the outputs in the array and then compare

  8. In all the outputs the UUID must be the same (means the UUID of data store must be present in the data store output, paths output and RDM LUN output if the RDM is connected)

  9. Then compare the output get the path counts and dead path details and all properties of the data store and store every detail in the array.

  10. Export the output and remove the variable so it will not append for the next ESXi input.

Please find the script below



Thanks for visiting 

Bangalore,

Siddartha1192@gmail.com

+919148014455

  • Linkedin
  • Wix Facebook page
  • Wix Twitter page

Subscribe to get exclusive updates

bottom of page