Rename local host storage to “hostname-local” – Cluster wide

This code will get all of the host names in a cluster, parse the names (if you use FQDN for your hostnames), and rename the default “datastore1” to “hostname-local” format
This will help resolve the issue of having a lot of “datastore1 (99)” showing in your Datastores view.
***Note, if you use the word “datastore1” for other storage locations or have a host with more than one local storage device named “datastore1” this may explode.

$hostnames = get-cluster mycluster | get-vmhost | %{$_.name}
foreach($ahost in $hostnames){
$one1 = $ahost.split(“.”)
$two2 = $one1[0]
$thename = $two2+”-local”
get-vmhost $ahost | get-datastore | where {$_.name -match “datastore1”} | set-datastore -name $thename
}

Vmware Link:
http://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Set-Datastore.html