Adding and removing Equallogic ACL’s

Sometimes you may want to add or remove ESX/ESXi hosts (or HyperV of anything really) where you need to add or remove entries from the Equallogic SAN ACL.

For examples, we have about 25 volumes connected to our ESX cluster and when we replace a new host, we need to add a new entry, on all 25, and remove an entry on all 25.

So I wrote a powershell script to do the hard work. THe following code can be saved as set-eqlinitiator.ps1.

To use it, you would execute it like this:

Set-eqlInitator.ps1 "" remove

That would remove the supplied initiator from all the the volumes that meet the criteria. What criteria? This one:
{$_.VolumeName -like "VMFS*"}

If you want to add (rather than remove) run the same command without specifying “remove”.

All of our ESX volume start with VMFS which makes it fairly easy. You may need to change the filter depending on how you name them in your environment.

So here is the code:

param ([string]$initiator,[string]$remove)

#Check if the EQL add-in's are loaded
if (-not(get-module -name "EqlPSTools"))
	Write-Host "EqlPSTools not loaded, attempting to load."
	import-module -name "C:\Program Files\EqualLogic\bin\EqlPSTools.dll"
	if (-not(get-module -name "EqlPSTools"))
		Write-Host "Loading of EqlPSTools failed, script ending."

If ($initiator -eq "")
	$initiator = Read-Host "Please enter the iSCSI initiator name:"

Connect-EqlGroup 	-GroupAddress `
					-UserName grpadmin `
					-Password PASSWORD

If ($initiator -ne "")
	If ($remove -ne "remove")
		get-eqlvolume | `
		where {$_.VolumeName -like "VMFS*"} | `
		New-EqlVolumeACL -UseIndex -InitiatorName $initiator -AclTargetType volume_and_snapshot
		Write-Host "added initiator $initiator"
		get-eqlvolume | `
		where {$_.VolumeName -like "VMFS*"} | `
		Get-EqlVolumeACL | Where {$_.InitiatorName -match $initiator} | `
		Remove-EqlVolumeACL -AclIndex {$_.index}
		Write-Host "removed initiator $initiator"

Or you can grab a copy from here:


Leave a comment

Filed under Equallogic, Microsoft, Powershell, VMware

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s