In my last Hey, Scripting Guy! blog post, Managing Symantec Backup Exec 2012 with PowerShell, I referenced that Windows PowerShell was something that could be used to manage everything in your datacenter, from product backup to the storage area network. Today I get a chance to discuss the second half of that (the storage area network portion).

The first thing you need to manage your EqualLogic PS Series storage area network (SAN) with Windows PowerShell is the EqualLogic Host Integration Tools for Microsoft also known as the HIT Kit for Microsoft, which can be downloaded from the EqualLogic support site. The most recent version of the HIT Kit is version 4.0.0, which was released in January 2012. It contains 67 Windows PowerShell cmdlets.

We will start by creating a new volume on our EqualLogic SAN with Windows PowerShell, and we will set up everything that you may forget about through the GUI, such as a snapshot schedule. There is nothing worse than needing something from a snapshot only to figure out, “Oh yeah, I forgot to set that up.” I am going to define all of the parameters as variables because I will be reusing them for each of the scripts that we will run against our SAN. It is also easier to simply modify the variables at the top of the script for each new volume that is provisioned instead of having to manually find the values that are buried in the script somewhere.

In my opinion, there are too many values to use a parameterized query and anyone who is allowed to provision storage on my SAN will be qualified to modify this script. I save the script for each of the volumes when they are created in case I ever need to know how they were originally provisioned or if they need to be re-created due to a disaster.

The following script creates a thin provisioned 36 GB volume named “mikefrobbins” with a snapshot reserve of 100%. It sets the description, creates access control list based on the iSCSI host IP address, and schedules a snapshot of the volume once a day at 1:00 AM. It will attempt to keep seven snapshots provided that their combined size doesn’t exceed the 100% snapshot reserve.

When the previous script is run, you will be prompted for a username and password for the SAN as shown here:

Grpadmin is the built in “administrator” account for all EqualLogic PS Series SANs. I recommend creating a personalized admin account for each of your SAN administrators for auditing purposes, and only using the grpadmin account for password recovery purposes so you do not have to call support as referenced in my blog post on that subject, EqualLogic PS Series SAN Password Recovery.

Because I have not disconnected my session from the SAN, I can continue to manage it without having to reconnect. Here I will take a manual snapshot of the volume that was created in the previous step:

Now let us restore the volume to the latest snapshot. Any time a volume is restored (reverted) to a previous snapshot, a new snapshot is automatically created prior to performing the restore operation.

It is maintenance time. I have a volume that is going to be moved from one host server to another, and I need to modify its ACLs accordingly. I’m going to place the new server’s iSCSI IP addresses into two variables, take a snapshot of the volume before making any changes to it, set the volume offline to make sure nothing is accessing it, write the current ACLs to a text file for documentation purposes, remove the current ACLs, add the new ACLs, write the new ACLs to the same text file without overwriting it, and then place the volume online so that it’s ready to be connected to the new server.

Dean, I resolved our password issue by using another username and password. This new username and password I used was less than 9 characters and was a combinations of letters and numbers. I am thinking some special characters are troublesome.