Set-XenVDI

Last published : Nov 12, 2026
Sets fields of a VDI object.

Syntax

Set-XenVDI [-VDI] <VDI> [-PassThru] [-OtherConfig <hashtable>] [-XenstoreData <hashtable>]
    [-SmConfig <hashtable>] [-Tags <string[]>] [-Sharable <bool>] [-ReadOnly <bool>]
    [-NameLabel <string>] [-NameDescription <string>]
    [-OnBoot {reset | persist | unknown}] [-AllowCaching <bool>] [-BestEffort]
    [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-XenVDI [-Ref] <XenRef[VDI]> [-PassThru] [-OtherConfig <hashtable>]
    [-XenstoreData <hashtable>] [-SmConfig <hashtable>] [-Tags <string[]>]
    [-Sharable <bool>] [-ReadOnly <bool>] [-NameLabel <string>]
    [-NameDescription <string>] [-OnBoot {reset | persist | unknown}]
    [-AllowCaching <bool>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm]
    [<CommonParameters>]
Set-XenVDI [-Uuid] <guid> [-PassThru] [-OtherConfig <hashtable>]
    [-XenstoreData <hashtable>] [-SmConfig <hashtable>] [-Tags <string[]>]
    [-Sharable <bool>] [-ReadOnly <bool>] [-NameLabel <string>]
    [-NameDescription <string>] [-OnBoot {reset | persist | unknown}]
    [-AllowCaching <bool>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm]
    [<CommonParameters>]
Set-XenVDI [-Name] <string> [-PassThru] [-OtherConfig <hashtable>]
    [-XenstoreData <hashtable>] [-SmConfig <hashtable>] [-Tags <string[]>]
    [-Sharable <bool>] [-ReadOnly <bool>] [-NameLabel <string>]
    [-NameDescription <string>] [-OnBoot {reset | persist | unknown}]
    [-AllowCaching <bool>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm]
    [<CommonParameters>]

Description

Changes writable fields of a VDI. Each optional parameter listed below corresponds to a field that can be set.

Parameters

-AllowCaching

Set the value of the allow\_caching parameter. This value can only be changed when the VDI is not attached to a running VM. The caching behaviour is only affected by this flag for VHD-based VDIs that have one parent and no child VHDs. Moreover, caching only takes place when the host running the VM containing this VDI has a nominated SR for local caching.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Async

If set, the operation runs asynchronously and returns a Task object that can be used to track its progress. Available only for those fields whose underlying operation supports asynchronous invocation.
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

-Name

The name of the VDI to operate on.
Attribute Value
Type string
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases name_label

-NameDescription

Set the name description of the VDI. This can only happen when its SR is currently attached.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-NameLabel

Set the name label of the VDI. This can only happen when then its SR is currently attached.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-OnBoot

Set the value of the on\_boot parameter. This value can only be changed when the VDI is not attached to a running VM.
Attribute Value
Type on_boot
Required False
Position Named
Accepts pipeline input False
Accepted values reset, persist, unknown

-OtherConfig

Set the other\_config field of the given VDI.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-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

-ReadOnly

Sets the VDI's read\_only field
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Ref

The VDI object to operate on, specified by its opaque reference.
Attribute Value
Type XenRef[VDI]
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

-Sharable

Sets the VDI's sharable field
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-SmConfig

Set the sm\_config field of the given VDI.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-Tags

Set the tags field of the given VDI.
Attribute Value
Type string[]
Required False
Position Named
Accepts pipeline input False

-Uuid

The UUID of the VDI to operate on.
Attribute Value
Type guid
Required True
Position 0
Accepts pipeline input True (ByPropertyName)

-VDI

The VDI object to operate on.
Attribute Value
Type VDI
Required True
Position 0
Accepts pipeline input True (ByValue)

-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

-XenstoreData

Set the xenstore\_data field of the given VDI.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

Inputs

  • VDI
  • XenRef[VDI]
  • guid
  • string

Outputs

  • VDI
  • Task
  • void

Examples

Example 1: Set the OtherConfig field

PS> Get-XenVDI -Name "Demo VDI" | Set-XenVDI -OtherConfig @{ "key" = "value" }
Sets the OtherConfig field of a VDI.

Example 2: Set the XenstoreData field

PS> Get-XenVDI -Name "Demo VDI" | Set-XenVDI -XenstoreData @{ "key" = "value" }
Sets the XenstoreData field of a VDI.

Example 3: Set the SmConfig field

PS> Get-XenVDI -Name "Demo VDI" | Set-XenVDI -SmConfig @{ "key" = "value" }
Sets the SmConfig field of a VDI.
  • Class: VDI
  • Using the XenServer PowerShell module