Hi LucD,
Thanks for the feedback, i tried what you suggested, however im obviously doing something wrong.
I put the syntax into a write-host loop to test it first, and get the following error:
Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.Inventory
.ClusterImpl] doesn't contain a method named 'Split'.
At line:3 char:31
+ $Shortname = $VMHostname.Split <<<< (1.1)[0]
+ CategoryInfo : InvalidOperation: (Split:String) [], RuntimeExce
ption
+ FullyQualifiedErrorId : MethodNotFound
Here is my sample script.
$ClusterHost = Get-Cluster "Test_G" | Get-VMHost - Name
ForEach ($VMhostname in $ClusterHost)
{
$Shortname = $VMHostname.Split(1.1)[0]
write-host $Shortname
}
# $null = Get-VMhost $VMhostname | Get-Datastore | Set-Datastore -Name {$Shortname.Split('.')[0]}boot;
Thanks