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 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.
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 is 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 by 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