Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 182084

Re: Getting HA-status from PowerCLI

$
0
0

Try something like this

 

&{Get-View-ViewTypeVirtualMachine|%{
 
New-ObjectPSObject-Property@{
   
Name=$_.Name
   
Host=Get-View$_.Summary.Runtime.Host|Select-ExpandPropertyName
   
Datastores= [system.String]::Join(",",($_.Storage.PerDatastoreUsage|%{Get-View$_.Datastore} |%{$_.Name}))
   
ProvisionedGB= [math]::Round( ($_.Storage.PerDatastoreUsage|Measure-Object-PropertyCommitted-Sum|Select-ExpandPropertySum)/1GB,1)
   
NumCPU=$_.Config.Hardware.NumCPU
   
NumvCPU=&{if($_.Config.Hardware.NumCoresPerSocket-gt0){$_.Config.Hardware.NumCPU/$_.Config.Hardware.NumCoresPerSocket}}
   
DASStatus=&{if($_.Runtime.dasvmprotection.dasProtected){$_.Runtime.dasvmprotection.dasProtected}else{$false}}
  }
}}
|Export-Csv"C:\Powershell\VM-report.csv"-NoTypeInformation-UseCulture

Note sure what you wanted to display under NumvCPU ?


Viewing all articles
Browse latest Browse all 182084

Trending Articles