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

Get Complete Inventory PowerCLI

$
0
0

What I'm trying to get is the following;

 

Complete inventory with WWN names,

All instances running,

CPU type,

Number of CPU's per host and VM,

Number of cores and I want the output to go to my local drive (c:/scripts/reports.

 

Below is a sample of what I have and I'm just looking to ass the list I have above added to the script.

 

$VmInfo = ForEach ($Datacenter in (Get-Datacenter | Sort-Object -Property Name)) {

  ForEach ($Cluster in ($Datacenter | Get-Cluster | Sort-Object -Property Name)) {

    ForEach ($VM in ($Cluster | Get-VM | Sort-Object -Property Name)) {

      ForEach ($HardDisk in ($VM | Get-HardDisk | Sort-Object -Property Name)) {

        "" | Select-Object -Property @{N="VM";E={$VM.Name}},        @{N="Datacenter";E={$Datacenter.name}},        @{N="Cluster";E={$Cluster.Name}},        @{N="Hard Disk";E={$HardDisk.Name}},        @{N="Datastore";E={$HardDisk.FileName.Split("]")[0].TrimStart("[")}},        @{N="VMConfigFile";E={$VM.ExtensionData.Config.Files.VmPathName}},        @{N="VMDKpath";E={$HardDisk.FileName}},        @{N="VMDK Size";E={($vm.extensiondata.layoutex.file|?{$_.name -contains $harddisk.filename.replace(".","-flat.")}).size/1GB}},        @{N="Drive Size";E={$HardDisk.CapacityGB}}

      }

    }

  }

}

$VmInfo | Export-Csv -NoTypeInformation -UseCulture -Path "C:\scripts\xxxxxx.csv"


Viewing all articles
Browse latest Browse all 179681

Trending Articles



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