Edit

Share via


Add-IscsiVirtualDiskTargetMapping

Assigns a virtual disk to an iSCSI target.

Syntax

Default (Default)

Add-IscsiVirtualDiskTargetMapping
    [-TargetName] <String>
    [-Path] <String>
    [-Lun <Int32>]
    [-ComputerName <String>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

Description

The Add-IscsiVirtualDiskTargetMapping cmdlet assigns a virtual disk to an iSCSI target. Once a virtual disk has been assigned to a target, and after the iSCSI initiator connects to that target, the iSCSI initiator can access the virtual disk. All of the virtual disks assigned to the same iSCSI target can be accessed by the connected iSCSI initiator.

Examples

Example 1: Associate a VHD with a target

PS C:\> Add-IscsiVirtualDiskTargetMapping -TargetName "TargetOne" -DevicePath "E:\Temp\vhd1.vhdx"

This example associates the VHD with the path E:\Temp\vhd1.vhdx to the target named TargetOne.

Example 2: Associate a VHD with a target and set the LUN

PS C:\> Add-IscsiVirtualDiskTargetMapping -TargetName "TargetOne" -DevicePath "E:\Temp\vhd1.vhdx" -Lun 0

This example associates the VHD with the path E:\Temp\vhd1.vhdx to the target named TargetOne, and sets the LUN to 0. It is important that the LUN number for a given target is unique.

Example 3: Associate a ramdisk with a target

PS C:\> Add-IscsiVirtualDiskTargetMapping -TargetName "TestTarget" -Path "ramdisk:test.vhdx"

This example assigns the ramdisk called test to the target object named TestTarget. If the initiator connects to the TestTarget, it can access the RAMdisk.

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Credential

Specifies the credentials when connecting to a remote computer.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Lun

Specifies the logical unit number (LUN) associated with the virtual disk. By default, the lowest available LUN number is assigned.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

Specifies the path of the virtual hard disk (VHD) file that is associated with the iSCSI virtual disk. Filter the iSCSI Virtual Disk object by using this parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DevicePath

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TargetName

Specifies the name of the iSCSI target.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

None