< Back

Get-VIObjectByVIView

Sun Jan 19, 2020 6:53 pm

NAME Get-VIObjectByVIView



SYNOPSIS

This cmdlet converts a vSphere View object to a VIObject.





SYNTAX

Get-VIObjectByVIView [-MORef] <ManagedObjectReference[]> [-Server <VIServer[]>] [<CommonParameters>]



Get-VIObjectByVIView [-VIView] <ViewBase[]> [<CommonParameters>]





DESCRIPTION

This cmdlet converts a vSphere View object to a VIObject using the object ID provided by the MoRef parameter. If

the View object is a ServiceInstance, you cannot convert it to a VIObject.





PARAMETERS

-MORef <ManagedObjectReference[]>

Specifies the managed object ID, obtained from a property of another managed object or a view.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Server <VIServer[]>

Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this

parameter, the command runs on the default servers. For more information about default servers, see the

description of Connect-VIServer.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-VIView <ViewBase[]>

Specifies the vSphere .NET View object you want to convert to a VMware PowerCLI object.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Zero or more VIObject objects







NOTES









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



$view = Get-VM VM | Stop-VM | Get-View



$vm = Get-VIObjectByVIView $view | Start-VM



Gets the VM virtual machine, stops it, and gets its view object. Then, the command gets the virtual machine object

using the Get-VIObjectByVIView cmdlet and starts the VM virtual machine.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... IView.html

Get-View