Invoke-XenVBD
Invokes an operation on a VBD object.
Syntax
Invoke-XenVBD [-VBD] <VBD>
-XenAction {Eject | Insert | Plug | Unplug | UnplugForce | AssertAttachable}
[-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
[<CommonParameters>]
Invoke-XenVBD [-Ref] <XenRef[VBD]>
-XenAction {Eject | Insert | Plug | Unplug | UnplugForce | AssertAttachable}
[-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
[<CommonParameters>]
Invoke-XenVBD [-Uuid] <guid>
-XenAction {Eject | Insert | Plug | Unplug | UnplugForce | AssertAttachable}
[-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
[<CommonParameters>]
Description
Invokes an operation on a VBD object. Use the -XenAction parameter to select which operation to perform.
Eject: Remove the media from the device and leave it empty.
Insert: Insert new media into the device.
Plug: Hotplug the specified VBD, dynamically attaching it to the running VM.
Unplug: Hot-unplug the specified VBD, dynamically unattaching it from the running VM.
UnplugForce: Forcibly unplug the specified VBD.
AssertAttachable: Throws an error if this VBD could not be attached to this VM if the VM were running. Intended for debugging.
Parameters
-Async
If set, the operation runs asynchronously and returns a Task object that can be used to track its progress.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-BestEffort
If set, the cmdlet continues processing further objects instead of throwing a terminating error when an operation fails for one object.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Confirm
Prompts for confirmation before running the cmdlet.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
| Aliases | cf |
-PassThru
If set, the cmdlet returns the affected object. By default the cmdlet does not generate any output.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Ref
The VBD object to operate on, specified by its opaque reference.
| Attribute | Value |
|---|---|
| Type | XenRef[VBD] |
| Required | True |
| Position | 0 |
| Accepts pipeline input | True (ByPropertyName) |
| Aliases | opaque_ref |
-SessionOpaqueRef
The session object on which to run the cmdlet. This overrides the default session and lets you target a specific open XenServer connection.
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Uuid
The UUID of the VBD to operate on.
| Attribute | Value |
|---|---|
| Type | guid |
| Required | True |
| Position | 0 |
| Accepts pipeline input | True (ByPropertyName) |
-VBD
The VBD object to operate on.
| Attribute | Value |
|---|---|
| Type | VBD |
| Required | True |
| Position | 0 |
| Accepts pipeline input | True (ByValue) |
-VDI
The new VDI to 'insert'. Accepted when -XenAction is Insert.
| Attribute | Value |
|---|---|
| Type | XenRef[VDI] |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
| Aliases | wi |
-XenAction
Selects which action to use.
| Attribute | Value |
|---|---|
| Type | XenVBDAction |
| Required | True |
| Position | Named |
| Accepts pipeline input | False |
| Accepted values | Eject, Insert, Plug, Unplug, UnplugForce, AssertAttachable |
Inputs
-
VBD -
XenRef[VBD] -
guid
Outputs
-
System.Object
Examples
Example 1: Run the Eject operation
PS> Get-XenVBD -Uuid 1871ac51-ce6b-efc3-7fd0-28bc65aa39ff | Invoke-XenVBD -XenAction Eject
Invokes the Eject operation on a VBD.
Example 2: Detach and reattach a disk
PS> $vbd = Get-XenVBD | Where-Object { $_.type -eq "Disk" } | Select-Object -First 1
PS> $vbd | Invoke-XenVBD -XenAction Unplug
PS> $vbd | Invoke-XenVBD -XenAction Plug
Unplug makes the disk no longer live to the guest but leaves it attached to the VM; removing it is Remove-XenVBD. Unplug fails if the guest is using the disk and will not release it - UnplugForce does not ask.
Example 3: Run the Eject operation by uuid
PS> Invoke-XenVBD -XenAction Eject -Uuid 1871ac51-ce6b-efc3-7fd0-28bc65aa39ff
Invokes the Eject operation on a VBD. -Uuid is the way to be sure of exactly one object.
Related links
-
Class: VBD
-
Using the XenServer PowerShell module