vSphere PowerCLI Reference

Get-View

Synopsis

Returns the vSphere .Net view objects that correspond to the specified search criteria.

Syntax

Get-View [-VIObject] <VIObject[]> [-Property <String[]>] [<CommonParameters>]
Get-View [-Server <VIServer[]>] [-Id] <ManagedObjectReference[]> [-Property <String[]>] [<CommonParameters>]
Get-View [-Server <VIServer[]>] [-SearchRoot <ManagedObjectReference>] -ViewType <Type> [-Filter <Hashtable>] [-Property <String[]>] [<CommonParameters>]

Related Commands

Online version
Get-VIObjectByVIView

Detailed Description

Returns the vSphere .Net view objects that correspond to the specified search criteria. The cmdlet retrieves the vSphere .NET view objects specified by their IDs or by their corresponding vSphere inventory objects (VIObject). A view object ID is a <type>-<value> string. For objects with constant names such as AlarmManager and ServiceInstance, the ID format is <type> (see the examples).
For more information about vSphere.NET objects, see the vSphere SDK for .NET Developer's Guide.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
IdManagedObjectReference[]Specify the IDs of the .NET View objects you want to retrieve. A view object ID is a <type>-<value> string. For objects with constant names such as AlarmManager and ServiceInstance, the ID format is <type> (see the examples).truefalse
VIObjectVIObject[]Specify the corresponding vSphere managed object of the .NET View object you want to retrieve.truetrue (ByValue)
FilterHashtableSpecify a hash of <name>-<value> pairs, where <name> represents the property value to test, and <value> represents a pattern the property must match. If more than one pair is present, all the patterns must match.falsefalse
PropertyString[]Specify the properties of the view object you want to retrieve. If no value is given, all properties are shown.falsefalse
SearchRootManagedObjectReferenceSpecify a starting point for the search (in the context of the inventory).falsefalse
ServerVIServer[]Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
ViewTypeTypeSpecify the type of the view objects you want to retrieve.truefalse

Return Type

VMware.Vim.ViewBase or VMware.Vim.EntityViewBase

Notes

Examples

-------------- Example 1 --------------

$vm = Get-View -ViewType VirtualMachine -Filter @{"Name" = "VM"}  $hostView = Get-View -ID $vm.Runtime.Host  $hostView.Summary.Runtime

Gets the VM virtual machine using a filter by name, populates the view object and retrieves the runtime information.


Copyright © 1998 - 2011 VMware, Inc. All rights reserved.