Configuring Exchange 2013 with PowerShell- Part 3: Storage
Wednesday, February 20, 2013 at 1:15PM
Patch Charron in Equallogic, Exchange 2013, Exchange 2013, powershell

So we are doing really good, we have our networking configured and the Prereqs installed, lets get to the storage.

NOTE: This is designed around using Equallogic storage, if you are using a different kind of storage you can take some of the principals and apply them to your environment.
First lets setup our variables:

$ServerName = "EX2013-01"
$lUNNames = "$serverName-DB1", "$serverName-DB2", "$serverName-Logs"
$lUNSizes = "700000","700000","100000" # Size in MB
$driveNames = "DB1", "DB2", "Logs"
$driveLetters = "K", "L","M"
$eqlGroupIP = ""
$eqlDiscoveryIP = ""
$storagePoolName = "default"

Just like when we configured our networking, make sure everything is in the right order and that the same number of items are in each array.

For this next section, make sure you have either used the default HIT Kit install directory or change the first line to the install location. Dell has a really good PowerShell tutorial that can be downloaded alongside the HIT kit.

First we need to import the module:

import-module -name "C:\Program Files\EqualLogic\bin\EqlPSTools.dll"

Next lets connect to the group. NOTE: This requires you know the credentails for the group.

Connect-EqlGroup -GroupAddress $eqlGroupIP -Credential (Get-Credential)

Now that we are connected lets make some volumes, do note that this sets the server that the script is running on with read and write access. If this doesn't follow your organization settings change the New-EqlVolumeAcl cmdlet.

        $iqn = (Get-InitiatorPort).NodeAddress

        for($i = 0; $i -lt $lUNNames.Length; $i++)
                New-EqlVolume -VolumeName $LunNames[$i] -VolumeSizeMB $lUNSizes[$i] -StoragePoolName $storagePoolName -SnapshotReservePercent 100
                New-EqlVolumeAcl -VolumeName $LunNames[$i] -InitiatorName $iqn -AclTargetType volume_and_snapshot

Now lets enable iSCSI Initiator and refresh the group to discover our newly created volumes.

        Start-Service msiscsi
        Set-Service msiscsi -StartupType Automatic

        New-IscsiTargetPortal -TargetPortalAddress $eqlDiscoveryIP
        Start-sleep -Seconds 3
        Get-iscsiTargetPortal | Update-IscsiTargetPortal
        Start-sleep -Seconds 8

Here is the fun part, This can be a little confusing so I will first explain what these 17 lines does.
First we will connect the first volume in the $LUNNames variable then initalize the disk as GPT style, bring it online, format it assign the drive letter, use 64kb allocation size and name it, then go on to the next volume until it has configured all of the volumes in the array. This step took a decent amount of time to perfect, it is only designed to run once, if you have an error you will need to delete the volumes from the SAN and start over. Disks don't like getting initalized twice.

        for($i = 0; $i -lt $lUNNames.Length; $i++)
            $volume = $lUNNames[$i]
            Get-IscsiTarget | where{$_.NodeAddress -like "*$volume"} | Connect-IscsiTarget -IsMultipathEnabled:$true -IsPersistent:$true
          [int]$disknumber =  Get-Disk| Where {$_.BusType -match "iSCSI" -and $_.OperationalStatus -eq "Offline"}| Select -ExpandProperty Number

           start-sleep -Seconds 1

            Initialize-Disk -Number $disknumber -PartitionStyle GPT
            Set-Disk -number $disknumber  -IsOffline:$false

            start-sleep -Seconds 1

            New-Partition -DiskNumber $disknumber -UseMaximumSize -DriveLetter $driveLetters[$i]  | Format-Volume -AllocationUnitSize 64kb  -FileSystem NTFS -NewFileSystemLabel $driveNames[$i] -Confirm:$false
        start-sleep -Seconds 1


So thats it, this step will create, connect and configure the storage for your Exchange server. Each piece of this can be pasted together in order and run as one script which is the way I designed it. Next up we will configure a Kemp Load Balancer.

Article originally appeared on Patch Charron (
See website for complete article licensing information.