Pages: [1]
Print
Author Topic: Find Best Datastore Function  (Read 1172 times)
ewannema
Administrator
Newbie
*****
Posts: 33


View Profile WWW
« on: January 15, 2009, 11:54:04 AM »

The criteria for "best" can easily be modified.

Code:
#
# In this version best is defined the most free space
# Usage:    find_best_datastore <vmhost object>
# Example: find_best_datastore (Get-VMHost myvmhost)
#
Function find_best_datastore
{
Param
(
[VMware.VimAutomation.Client20.VMHostImpl]$vmhost = $(throw "A vmhost must be provided to find_datastore")
)

$ds = $vmhost | Get-Datastore | `
Sort -Property FreeSpaceMB -Descending | Select-Object -First 1
$ds.name
}
« Last Edit: January 15, 2009, 12:09:10 PM by esarakaitis » Logged
Pages: [1]
Print
Jump to: