Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 182126

PowerCLI script to import vcenter names, connect to them and pull information

$
0
0

Hi All,

I currently have a working script called 'VMtoCPU.ps1' that will collect information on resources used by VMs:

 

 

 

 

Get-VM |

 

 

 

 

  ForEach-Object {

     $Report=""|sort-DescendingNumCpu|Select-Object-propertyName,NumCpu,MemoryMB,VMHost

     $Report.Name=$_.Name

     $Report.NumCpu=$_.NumCpu

     $Report.MemoryMB=$_.MemoryMB

     $Report.VMHost=$_.VMHost

 

 

 

 

   Write-Output$Report

 

   } |Export-CsvVMinf.csv-NoTypeInformation

 

 

 

 

Get-Content Vminf.csv|Foreach-Object {$_-replace"`"", ""} |Set-ContentTOUT.csv

Get-Content TOUT.csv|%{

      $_.TrimEnd(',')

} |Set-ContentVMinf.csv

 

 

 

 

 

Rob.

 

 

 

 

 

What I would like to do, is have a file called 'vCenterList.ini' listing a number of vCenter servers like this:

 

 

vCenters

vCenter-001

vCenter-002

vCenter-003

vCenter-004

vCenter-005

vCenter-006

 

 

 

...that I can read into the 'VmtoCPU.ps1' script, connect to each vCenter, run and append to the outputted csv file.

 

Any ideas folks?

 

Best,

 


Viewing all articles
Browse latest Browse all 182126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>