Add-IscsiVirtualDiskTargetMapping

Assigns a virtual disk to an iSCSI target.

Syntax

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 will be accessible by the connected iSCSI initiator.

Examples

EXAMPLE 1

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

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

EXAMPLE 2

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

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

EXAMPLE 3

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

This example assigns the ramdisk called test to the target object named TestTarget. When the initiator connects to the TestTarget, it will be able to 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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Credential

Specifies the credentials when connecting to a remote computer.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Lun

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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 using this parameter.

Type:String
Aliases:DevicePath
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetName

Specifies the name of the iSCSI target.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

None

Outputs

None