ConvertTo-XenRef
Converts a XenServer object to an object reference.
Syntax
ConvertTo-XenRef [-XenObject] <IXenObject> [<CommonParameters>]
Description
Converts a XenServer object into the corresponding opaque reference (XenRef) that can be passed to other cmdlets.
Parameters
-XenObject
The XenServer object to convert into an opaque reference.
| Attribute | Value |
|---|---|
| Type | IXenObject |
| Required | True |
| Position | 0 |
| Accepts pipeline input | True (ByValue) |
Inputs
-
IXenObject
Outputs
-
IXenObject
Examples
Example 1: Convert an object to a reference
PS> Get-XenVM -Name "Demo VM" | ConvertTo-XenRef
Converts a VM object into the XenRef that other cmdlets accept.
Example 2: Convert several objects at once
PS> Get-XenVM | ConvertTo-XenRef
The whole collection is converted, one reference out for each object in.
Example 3: Keep a reference for later
PS> $ref = Get-XenVM -Name "Demo VM" | ConvertTo-XenRef
PS> Invoke-XenVM -Ref $ref -XenAction Start
A reference stays valid while the object does, so it can be held and passed to the cmdlets that take -Ref.
Related links
-
Using the XenServer PowerShell module