Hello all
Just a quick one, but hopefully someone might be able to explain why this ISN'T working. I have the following New-VIproperty I would like to create but unfortunately it doesn't seem to be working ??!?!
New-VIProperty -ObjectType Cluster -Name FreeSpaceGB -Value {param ($cluster) ($cluster | get-vmhost | select -first 1 | get-datastore | where-object {$_.multiplehostaccess -eq $true} | measure-object -property FreespaceGB -sum).sum} -force
Things to mention:
- I am running the latest PowerCLI\Powershell versions
- the 'multiplehostaccess' property i am trying to call has already been created in another viproperty which works when i do a (Get-datastore | fl * )
- I have all of my viproperties in a separate file and when 'called' this viproperty is called after i've created all of my datastore viproperties. (if that makes sense)
I'm sure it might have something to do with the $_ variable but I cant seem to understand why its failing ?!??
As per usual any help would be greatly appreciated and Many thanks in advance.
Regards
Munster