Hi Luc,
good evening ,
if you could suggest on the following two scenarios.
orange code is using hash table .
green code is for splatting to check simple command .is this the correct way of using splatting??
$esxi_count=(get-vmhost).count
$vm_count=(get-vm).count
$vcenter=$global:DefaultVIServer
$Result = New-Object PSObject -Property @{
esxicount = $esxi_count;
vmcount = $vm_count;
#version_applaince = $version_appliance
vcenter=$global:DefaultVIServer
}
$result
#using splatting
$esxi_info = @{
location = "cluster1"
datastore = "datastore1"
}
get-vmhost @esxi_info
Yes, splatting uses a hash table to define the parameter and their values for a cmdlet.
You then call the cmdlet, and pass the hash table with the @ character.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm not Luc but I can confirm that's correct splatting
Yes, splatting uses a hash table to define the parameter and their values for a cmdlet.
You then call the cmdlet, and pass the hash table with the @ character.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc is green code working for you .i thought of using it on simple command however i am not getting any output for that.
thnaks.
Yes, it is.
Provided of course there are ESXi nodes in that cluster and that are associated to that datastore.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks it is working .
one extra thing i want to know if you
can you please suggest the most stable powercli version as of today to be updated to .
In theory, the latest version is always the greatest.
That is currently 11.5.0, see New Release – PowerCLI 11.5.0
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks.