Skip to content

Instantly share code, notes, and snippets.

@PlagueHO
Last active April 4, 2016 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PlagueHO/4aa6938ac6531971444f131f41a46cfe to your computer and use it in GitHub Desktop.
Save PlagueHO/4aa6938ac6531971444f131f41a46cfe to your computer and use it in GitHub Desktop.
Sample DSC Configuration to configure an iSCSI Server Target
Configuration ISCSI_SERVER_TARGET
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Import-DscResource -ModuleName xStorage
Import-DscResource -ModuleName ciSCSI
Node 'FS1' {
# Step 1 - Install the iSCSI Target Server Windows Feature (FS-iSCSITarget-Server).
WindowsFeature ISCSITargetServerInstall
{
Ensure = "Present"
Name = "FS-iSCSITarget-Server"
}
# Step 2 - Initialize and physical disks that will be used to store the iSCSI Virtual Disks (optional).
xWaitforDisk Disk2
{
DiskNumber = 1
RetryIntervalSec = 60
RetryCount = 60
}
xDisk DVolume
{
DiskNumber = 1
DriveLetter = 'D'
DependsOn = "[xWaitforDisk]Disk2"
}
File VirtualDisksFolder
{
Ensure = 'Present'
DestinationPath = 'D:\iSCSIVirtualDisks'
Type = 'Directory'
DependsOn = '[xDisk]DVolume'
}
# Step 3 - Create the iSCSI Virtual Disks that will be used by the iSCSI Server Target
ciSCSIVirtualDisk VDisk1
{
Ensure = 'Present'
Path = 'D:\iSCSIVirtualDisks\VDisk1.vhdx'
DiskType = 'Dynamic'
SizeBytes = 128GB
DependsOn = "[File]VirtualDisksFolder"
}
ciSCSIVirtualDisk VDisk2
{
Ensure = 'Present'
Path = 'D:\iSCSIVirtualDisks\VDisk2.vhdx'
DiskType = 'Dynamic'
SizeBytes = 128GB
DependsOn = "[File]VirtualDisksFolder"
}
ciSCSIVirtualDisk VDisk3
{
Ensure = 'Present'
Path = 'D:\iSCSIVirtualDisks\VDisk3.vhdx'
DiskType = 'Dynamic'
SizeBytes = 128GB
DependsOn = "[File]VirtualDisksFolder"
}
ciSCSIVirtualDisk VDisk4
{
Ensure = 'Present'
Path = 'D:\iSCSIVirtualDisks\VDisk4.vhdx'
DiskType = 'Dynamic'
SizeBytes = 128GB
DependsOn = "[File]VirtualDisksFolder"
}
# Step 4 - Create the iSCSI Server Target and optionally register it with an iSNS Server.
ciSCSIServerTarget iSCSIServerTarget
{
Ensure = 'Present'
TargetName = 'FS1-Server-Target'
InitiatorIds = @(
'Iqn:iqn.1991-05.com.microsoft:CLUS1.CONTOSO.COM'
'Iqn:iqn.1991-05.com.microsoft:CLUS2.CONTOSO.COM'
'Iqn:iqn.1991-05.com.microsoft:CLUS3.CONTOSO.COM'
)
Paths = @(
'D:\iSCSIVirtualDisks\VDisk1.vhdx'
'D:\iSCSIVirtualDisks\VDisk2.vhdx'
'D:\iSCSIVirtualDisks\VDisk3.vhdx'
'D:\iSCSIVirtualDisks\VDisk4.vhdx'
)
iSNSServer = 'isns1.contoso.com'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment