VMware Cloud Community
halr9000
Commander
Commander
Jump to solution

View Types

There's no docs on the more arcane cmdlets yet so I was poking around with find-entityview and when I tried specifying a viewtype parameter it did not like I get this:

Find-EntityViews : Specified argument was out of the range of valid values.

Parameter name: The provided view type is not a valid managed object type!

At C:\DOCUME1\HROTTE1\LOCALS~1\Temp\Untitled41.ps1:4 char:25

+ $Host = find-entityviews <<<< -viewtype Host

I think you should just list the valid values right there in the error text. That goes a long way towards the built in discoverability of powershell.

P.S. What are the valid types?

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

This is a concept lifted from the perl toolkit so the best documentation available for this right now is probably . Scroll down to page 22 for a description of "Managed entities." The short answer is:

Datacenter

Folder

HostSystem

VirtualMachine

ResourcePool

ClusterComputeResource

ComputeResource

View solution in original post

Reply
0 Kudos
2 Replies
admin
Immortal
Immortal
Jump to solution

This is a concept lifted from the perl toolkit so the best documentation available for this right now is probably . Scroll down to page 22 for a description of "Managed entities." The short answer is:

Datacenter

Folder

HostSystem

VirtualMachine

ResourcePool

ClusterComputeResource

ComputeResource

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

Is there any way "HostSystem" can be changed to VMHost? As far as I can see, it's the only type name which does not match the .NET type name

51# $a = get-inventory
52# $a | Group-Object {$_.GetType().Name}

Count Name                      Group
----- ----                      -----
    9 VMHostImpl                {VMware.VimAutomation.Client20.VMHostImpl, VMware.VimAutomation.Cli...
  175 VirtualMachineImpl        {VMware.VimAutomation.Client20.VirtualMachineImpl, VMware.VimAutoma...
    9 ResourcePoolImpl          {VMware.VimAutomation.Client20.ResourcePoolImpl, VMware.VimAutomati...
   11 FolderImpl                {VMware.VimAutomation.Client20.FolderImpl, VMware.VimAutomation.Cli...
    2 DatacenterImpl            {VMware.VimAutomation.Client20.DatacenterImpl, VMware.VimAutomation...

And here's an example of a richer error message which gives the available values:

PS C:\Users\hrottenberg\Desktop> Set-ExecutionPolicy -ExecutionPolicy dd
Set-ExecutionPolicy : Cannot bind parameter 'ExecutionPolicy'. Cannot convert v
alue "dd" to type "Microsoft.PowerShell.ExecutionPolicy" due to invalid enumera
tion values. Specify one of the following enumeration values and try again. The
 possible enumeration values are "Unrestricted, RemoteSigned, AllSigned, Restri
cted, Default".
At line:1 char:37
+ Set-ExecutionPolicy -ExecutionPolicy  <<<< dd

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos