New-IscsiVirtualDisk

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

Syntax

New-IscsiVirtualDisk
   [-Description <String>]
   [-Path] <String>
   [-Size] <UInt64>
   [-ComputerName <String>]
   [-Credential <PSCredential>]
   [<CommonParameters>]
New-IscsiVirtualDisk
   [-Description <String>]
   -ParentPath <String>
   [-Path] <String>
   [-ComputerName <String>]
   [-Credential <PSCredential>]
   [<CommonParameters>]

Description

The New-IscsiVirtualDisk cmdlet creates a new iSCSI Virtual Hard Disk (VHD) object with the specified file path and size. After the iSCSI VHD 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 VHD file path does not exist, then a new VHD file will then be created.

If the VHD file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing VHDs.

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 .VHD file extension. The iSCSI software target does not support the .VHDX file extension in this release.

-- The VHD file cannot be a network file, or be in a compressed, sparse, or transacted folder.

Examples

EXAMPLE 1

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

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

EXAMPLE 2

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

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

EXAMPLE 3

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

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

EXAMPLE 4

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

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

Required Parameters

-ParentPath

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Path

Specifies the path of the VHD file that is associated with the iSCSI virtual disk.

If the VHD file path does not exist, then a new VHD file will then be created.

If the VHD file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing VHDs.

Type:String
Aliases:DevicePath
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Size

Specifies the size of the iSCSI virtual disk. Note: This parameter takes a number and a unit as input, such as 10GB, 20MB, 1TB.

If this parameter is not provided, then a prompt for the input of this parameter with be displayed, as it is a required field. At that time, the value will need to be provided in Bytes; since no unit can be entered at the prompt.

Type:UInt64
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-ComputerName

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.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Credential

Specifies the credentials when connecting to a remote computer.

Type:PSCredential
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Description

Specifies the description for the iSCSI virtual disk.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Iscsi.Target.Commands.IscsiVirtualDisk