New-XenVDI

Last published : Nov 12, 2026
Creates a new VDI object.

Syntax

New-XenVDI -HashTable <hashtable> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenVDI -Record <VDI> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [-Async] [<CommonParameters>]
New-XenVDI [-PassThru] [-NameLabel <string>] [-NameDescription <string>]
    [-SR <XenRef[SR]>] [-VirtualSize <long>]
    [-Type {system | user | ephemeral | suspend | crashdump | ha_statefile | metadata | redo_log | rrd | pvs_cache | cbt_metadata | unknown}]
    [-Sharable <bool>] [-ReadOnly <bool>] [-OtherConfig <hashtable>]
    [-XenstoreData <hashtable>] [-SmConfig <hashtable>] [-Tags <string[]>] [-BestEffort]
    [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]

Description

Creates a new VDI object.
VDI: A virtual disk image.

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

-HashTable

A hashtable of field names to values, from which to create the VDI.
Attribute Value
Type hashtable
Required True
Position Named
Accepts pipeline input False

-NameDescription

a notes field containing human-readable description
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-NameLabel

a human-readable name
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-OtherConfig

additional configuration
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

true if this disk may ONLY be mounted read-only
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Record

An existing VDI record whose fields are used to create the new object.
Attribute Value
Type VDI
Required True
Position Named
Accepts pipeline input False

-SR

storage repository in which the VDI resides
Attribute Value
Type XenRef[SR]
Required False
Position Named
Accepts pipeline input False

-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

true if this disk may be shared
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-SmConfig

SM dependent data
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-Tags

user-specified tags for categorization purposes
Attribute Value
Type string[]
Required False
Position Named
Accepts pipeline input False

-Type

type of the VDI
Attribute Value
Type vdi_type
Required False
Position Named
Accepts pipeline input False
Accepted values system, user, ephemeral, suspend, crashdump, ha_statefile, metadata, redo_log, rrd, pvs_cache, cbt_metadata, unknown

-VirtualSize

size of disk as presented to the guest (in bytes). Note that, depending on storage backend type, requested size may not be respected exactly
Attribute Value
Type long
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

-XenstoreData

data to be inserted into the xenstore tree (/local/domain/0/backend/vbd/<domid>/<device-id>/sm-data) after the VDI is attached. This is generally set by the SM backends on vdi\_attach.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

Inputs

  • None

Outputs

  • VDI
  • Task
  • void

Examples

Example 1: Create a VDI from a table of fields

PS> New-XenVDI -HashTable @{ name_label = "Demo VDI" } -PassThru
The keys are the API's field names, so this form reads the same for every class whatever fields it happens to have. -PassThru returns the new VDI.

Example 2: Create a VDI from parameters

PS> New-XenVDI -NameLabel "new value" -PassThru
The same thing with one parameter per field, which is the form that tab-completes. Get-Help New-XenVDI -Full lists them all.

Example 3: Create a VDI from an existing one

PS> $record = Get-XenVDI | Select-Object -First 1
PS> New-XenVDI -Record $record -PassThru
-Record takes a whole VDI record, so an existing object can be used as the template for a new one.
  • Class: VDI
  • Using the XenServer PowerShell module