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

Re: PowerCLI script for NFS Datastores

$
0
0

The selection of the VMs can be adjusted if required.

With

 

$vms=Get-VM|where {$_.PowerState-eq"PoweredOn"}

 

you will only get statistics for VMs that are currently powered on.

An alternative, if you don't want to see this error messages for VMs where there is no performance data for the selected interval, is to use the ErrorAction parameter. Like this

 

Get-Stat-Entity$vms-Stat$metrics-Start$start-ErrorActionSilentlyContinue|

 

Yes, you can adjust the interval by changing the Start parameter value.

And you can also use the Finish parameter to define the end of the interval.

See my PowerCLI & vSphere statistics – Part 1 – The basics post for some info on how to use the Get-Stat cmdlet.

 

To redirect the results to a CSV file use the Export-Csv cmdlet.

The last line would look someting like this

 

} |Export-Csvc:\report.csv-NoTypeInformation-UseCulture

Viewing all articles
Browse latest Browse all 232869

Trending Articles