Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

New-IscsiVirtualDisk

New-IscsiVirtualDisk

microsoft.iscsi.target.commands.dll

Synopsis

Creates an iSCSI virtual disk with the specified file path and size.

Syntax

New-IscsiVirtualDisk [-Path] [-SizeBytes] [-BlockSizeBytes] [-ComputerName] [-Credential] [-Description] [-LogicalSectorSizeBytes] [-PhysicalSectorSizeBytes] [<CommonParameters>]

New-IscsiVirtualDisk [-Path] [-SizeBytes] [-BlockSizeBytes] [-ComputerName] [-Credential] [-Description] [-DoNotClearData] [-LogicalSectorSizeBytes] [-PhysicalSectorSizeBytes] [-UseFixed] [<CommonParameters>]

New-IscsiVirtualDisk [-Path] [-SizeBytes] [-BlockSizeBytes] [-ComputerName] [-Credential] [-Description] [-PhysicalSectorSizeBytes] [-ParentPath] [<CommonParameters>]

Detailed Description

The New-IscsiVirtualDisk cmdlet creates a new iSCSI Virtual Hard Disk (VHDX) object with the specified file path and size. After the iSCSI VHDX object has been created, the virtual disk can be assigned to an iSCSI target. Once a virtual disk has been assigned to a target, and an initiator connects to that target, the iSCSI initiator can then access the virtual disk after the initiator connects to the target.

If the virtual hard disk file path does not exist, then a new VHDX file will then be created. If the VHDX file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing virtual hard disks.

If an error is displayed during the creation of the virtual disk, please check the following conditions: -- An absolute file path must be specified for the Path and ParentPath parameters. -- The virtual disk file name must have a .vhdx file extension. -- The VHDX file cannot be a network file, or be in a compressed, sparse, or transacted folder.

Parameters

-BlockSizeBytes <UInt32>

Specifies the block size, in bytes, for the VHDX. For fixed VHDX, if the value of the SizeBytes parameter is less than 32 MB, the default size if 2 MB. Otherwise, the default value is 32 MB. For dynamic VHDX, the default size is 2 MB. For differencing VHDX, the default size is the parent BlockSize.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ComputerName <String>

Specifies the computer name, or IP address, of the remote computer, if this cmdlet is run on a remote computer. Specifies the cluster resource group network name, or cluster node name, if this cmdlet is run on a cluster configuration.

If you do not specify a value for this parameter, the cmdlet uses the local computer.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Credential <PSCredential>

Specifies the credentials when connecting to a remote computer.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Description <String>

Specifies the description for the iSCSI virtual disk.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-DoNotClearData <SwitchParameter>

Indicates that the cmdlet does not clear the fixed VHDX. Because failing to clear data can reveal pre-existing data, we do not recommend this option.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-LogicalSectorSizeBytes <UInt32>

Specifies the logical sector size, in bytes, for the VHDX. The acceptable values for this parameter are:  512 and 4096. The default value is 512.

Aliases

None

Required?

false

Position

named

Default value

512

Accept pipeline input?

false

Accept wildcard characters?

false

-ParentPath <String>

Specifies the parent virtual disk path if the VHDX is a differencing disk.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Path <String>

Specifies the path of the VHDX file that is associated with the iSCSI virtual disk. If the VHDX file path does not exist, then a new VHDX file will then be created. If the virtual hard drive file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing virtual hard drives.

Aliases

DevicePath

Required?

true

Position

1

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-PhysicalSectorSizeBytes <UInt32>

Specifies the physical sector size, in bytes, for the VHDX. The acceptable values for this parameter are:  512 and 4096. The default value is 4096.

Aliases

None

Required?

false

Position

named

Default value

4096

Accept pipeline input?

false

Accept wildcard characters?

false

-SizeBytes <UInt64>

Specifies the size, in bytes, of the iSCSI virtual disk.

Aliases

Size

Required?

true

Position

2

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-UseFixed <SwitchParameter>

Indicates that the cmdlet creates a fixed VHDX.

Aliases

Fixed

Required?

true

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

Microsoft.Iscsi.Target.Commands.IscsiVirtualDisk

Notes

None

Examples

EXAMPLE 1

This example creates a fixed VHDX with 10GB in size.

PS C:\> New-IscsiVirtualDisk –Path "E:\temp\test.vhdx" -Size 10GB

EXAMPLE 2

This example creates a differencing VHDX, with the parent path E:\temp\test.vhdx and the differencing VHDX path is E:\temp\child\diff.vhdx.

PS C:\> New-IscsiVirtualDisk -ParentPath "E:\temp\test.vhdx" -Path "E:\temp\child\diff.vhdx"

EXAMPLE 3

This example creates a fixed VHDX with the size 10GB at E:\temp\test.vhdx on the computer named iscsisvr.

PS C:\> New-IscsiVirtualDisk –Path "E:\temp\test.vhdx" -Size 10GB -ComputerName "iscsisvr"

EXAMPLE 4

This example creates a VHDX with the size 20MB. This VHDX will not be saved, the VHDX will be lost if the wintarget service is restarted or the system is restarted.

PS C:\>New-IscsiVirtualDisk –Path ramdisk:test.vhdx –Size 20MB

Online Version
Checkpoint-IscsiVirtualDisk
Convert-IscsiVirtualDisk
Get-IscsiVirtualDisk
Import-IscsiVirtualDisk
Remove-IscsiVirtualDisk
Restore-IscsiVirtualDisk
Set-IscsiVirtualDisk