{"id":8911,"date":"2012-06-28T00:01:00","date_gmt":"2012-06-28T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/06\/28\/use-powershell-to-manage-an-equallogic-san\/"},"modified":"2012-06-28T00:01:00","modified_gmt":"2012-06-28T00:01:00","slug":"use-powershell-to-manage-an-equallogic-san","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-manage-an-equallogic-san\/","title":{"rendered":"Use PowerShell to Manage an EqualLogic SAN"},"content":{"rendered":"<p><b>Summary<\/b>: Guest blogger, Mike Robbins, talks about using Windows PowerShell to manage an EqualLogic SAN.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today we have a returning guest blogger, Mike F. Robbins, who will talk about Managing an EqualLogic PS Series storage area network with PowerShell.<\/p>\n<p>Now, here is Mike&#8230;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2235.mikerobbins.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2235.mikerobbins.jpg\" alt=\"Photo of Mike Robbins\" title=\"Photo of Mike Robbins\" \/><\/a><\/p>\n<p style=\"padding-left: 30px\">Mike F. Robbins is an MCITP, Windows PowerShell Enthusiast, IT Pro, senior systems engineer for Windows Server, Hyper-V, SQL Server, Exchange Server, SharePoint, Active Directory, and EqualLogic storage area networks. He has over eighteen years of professional experience providing enterprise computing solutions for educational, financial, health care, and manufacturing customers.<\/p>\n<p style=\"padding-left: 30px\">Blog: <a href=\"http:\/\/mikefrobbins.com\/\" target=\"_blank\">http:\/\/mikefrobbins.com<\/a><\/p>\n<p style=\"padding-left: 30px\">Twitter: <a href=\"https:\/\/twitter.com\/mikefrobbins\" target=\"_blank\">@mikefrobbins<\/a><span style=\"text-decoration: underline\"><\/span><\/p>\n<p>In my last Hey, Scripting Guy! blog post, <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/06\/02\/weekend-scripter-managing-symantec-backup-exec-2012-with-powershell.aspx\" target=\"_blank\">Managing Symantec Backup Exec 2012 with PowerShell<\/a>, 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).<\/p>\n<p>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 <a href=\"http:\/\/support.equallogic.com\/\" target=\"_blank\">EqualLogic support site<\/a>. The most recent version of the HIT Kit is version 4.0.0, which was released in January 2012. It contains 67 Windows &nbsp;PowerShell cmdlets.<\/p>\n<p>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, &ldquo;Oh yeah, I forgot to set that up.&rdquo; 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.<\/p>\n<p>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.<\/p>\n<p>The following script creates a thin provisioned 36&nbsp;GB volume named &ldquo;mikefrobbins&rdquo; 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&rsquo;t exceed the 100% snapshot reserve.<\/p>\n<p style=\"padding-left: 30px\">$GrpAddr = &#8220;10.100.100.100&#8221;<\/p>\n<p style=\"padding-left: 30px\">$VolName = &#8220;mikefrobbins&#8221;<\/p>\n<p style=\"padding-left: 30px\">$VolSize = &#8220;36864&#8221;<\/p>\n<p style=\"padding-left: 30px\">$SnapshotReserve = &#8220;100&#8221;<\/p>\n<p style=\"padding-left: 30px\">$Description = &#8220;C Drive for mikefrobbins WebServer&#8221;<\/p>\n<p style=\"padding-left: 30px\">$ThinProvision = &#8220;Yes&#8221;<\/p>\n<p style=\"padding-left: 30px\">$iSCSI1 = &#8220;10.0.0.1&#8221;<\/p>\n<p style=\"padding-left: 30px\">$iSCSI2 = &#8220;10.0.0.2&#8221;<\/p>\n<p style=\"padding-left: 30px\">$ACL = &#8220;volume_and_snapshot&#8221;<\/p>\n<p style=\"padding-left: 30px\">$SchName = &#8220;wwwDailySnapshot&#8221;<\/p>\n<p style=\"padding-left: 30px\">$SchType = &#8220;Daily&#8221;<\/p>\n<p style=\"padding-left: 30px\">$Start = &#8220;01:00AM&#8221;<\/p>\n<p style=\"padding-left: 30px\">$Repeat = &#8220;0&#8221;<\/p>\n<p style=\"padding-left: 30px\">$Count = &#8220;7&#8221;<\/p>\n<p style=\"padding-left: 30px\">Import-Module &#8220;c:\\program files\\EqualLogic\\bin\\EqlPSTools.dll&#8221;<\/p>\n<p style=\"padding-left: 30px\">Connect-EqlGroup -GroupAddress $GrpAddr -Credential (Get-Credential)<\/p>\n<p style=\"padding-left: 30px\">New-EqlVolume -VolumeName $VolName -VolumeSizeMB $VolSize -SnapshotReservePercent `<\/p>\n<p style=\"padding-left: 30px\">&nbsp;$SnapshotReserve -VolumeDescription $Description -ThinProvision $ThinProvision<\/p>\n<p style=\"padding-left: 30px\">New-EqlVolumeACL -VolumeName $VolName -InitiatorIpAddress $iSCSI1 -ACLTargetType $ACL<\/p>\n<p style=\"padding-left: 30px\">New-EqlVolumeACL -VolumeName $VolName -InitiatorIpAddress $iSCSI2 -ACLTargetType $ACL<\/p>\n<p style=\"padding-left: 30px\">New-EqlSchedule -VolumeName $VolName -ScheduleName $SchName -ScheduleType $SchType `<\/p>\n<p style=\"padding-left: 30px\">&nbsp;-StartTime $Start -TimeFrequency $Repeat -KeepCount $Count<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5102.san-1.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5102.san-1.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>When the previous script is run, you will be prompted for a username and password for the SAN as shown here:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1157.san-2.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1157.san-2.jpg\" alt=\"Image of prompt\" title=\"Image of prompt\" \/><\/a><\/p>\n<p>Grpadmin is the built in &ldquo;administrator&rdquo; 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, <a href=\"http:\/\/mikefrobbins.com\/2011\/06\/16\/equallogic-ps-series-san-password-recovery\/\" target=\"_blank\">EqualLogic PS Series SAN Password Recovery<\/a>.<\/p>\n<p>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:<\/p>\n<p style=\"padding-left: 30px\">New-EqlSnapshot -VolumeName $VolName<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5277.san-3.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5277.san-3.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>The following code determines what snapshots exist for this volume:<\/p>\n<p style=\"padding-left: 30px\">Get-EqlSnapshot -GroupAddress $GrpAddr -VolumeName $VolName |<\/p>\n<p style=\"padding-left: 30px\">Sort-Object CreationTimeStamp -descending | Select-Object SnapshotName<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5633.san-4.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5633.san-4.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Now, I&rsquo;ll remove all snapshots for this volume except for the latest one:<\/p>\n<p style=\"padding-left: 30px\">$VolSnaps = Get-EqlSnapshot -GroupAddress $GrpAddr -VolumeName $VolName<\/p>\n<p style=\"padding-left: 30px\">$VolSnaps | Sort-Object CreationTimeStamp |<\/p>\n<p style=\"padding-left: 30px\">Select-Object -first (($VolSnaps).Count -1) SnapshotName |<\/p>\n<p style=\"padding-left: 30px\">Remove-EqlSnapshot -VolumeName $VolName<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8004.san-5.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8004.san-5.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>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.<\/p>\n<p style=\"padding-left: 30px\">Get-EqlSnapshot -GroupAddress $GrpAddr -VolumeName $VolName |<\/p>\n<p style=\"padding-left: 30px\">Sort-Object CreationTimeStamp -descending | Select-Object SnapshotName -first 1 |<\/p>\n<p style=\"padding-left: 30px\">Restore-EqlSnapshot -GroupAddress $GrpAddr -VolumeName $VolName<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3771.san-6.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3771.san-6.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>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&rsquo;m going to place the new server&rsquo;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&rsquo;s ready to be connected to the new server.<\/p>\n<p style=\"padding-left: 30px\">$iSCSI1 = &#8220;10.0.0.11&#8221;<\/p>\n<p style=\"padding-left: 30px\">$iSCSI2 = &#8220;10.0.0.12&#8221;<\/p>\n<p style=\"padding-left: 30px\">New-EqlSnapshot -VolumeName $VolName<\/p>\n<p style=\"padding-left: 30px\">Set-EqlVolume -VolumeName $VolName -OnlineStatus offline<\/p>\n<p style=\"padding-left: 30px\">Get-EqlVolumeACL -VolumeName $VolName | Out-File &#8220;d:\\tmp\\$VolName`_ACLs.txt&#8221;<\/p>\n<p style=\"padding-left: 30px\">Remove-EqlVolumeACL -VolumeName $VolName<\/p>\n<p style=\"padding-left: 30px\">New-EqlVolumeACL -VolumeName $VolName -InitiatorIpAddress $iSCSI1 -ACLTargetType $ACL<\/p>\n<p style=\"padding-left: 30px\">New-EqlVolumeACL -VolumeName $VolName -InitiatorIpAddress $iSCSI2 -ACLTargetType $ACL<\/p>\n<p style=\"padding-left: 30px\">Get-EqlVolumeACL -VolumeName $VolName | Out-File -Append &#8220;d:\\tmp\\$VolName`_ACLs.txt&#8221;<\/p>\n<p style=\"padding-left: 30px\">Set-EqlVolume -VolumeName $VolName -OnlineStatus online<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2678.san-7.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2678.san-7.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Now let&rsquo;s remove the volume. The volume must first be taken offline to remove it.<\/p>\n<p style=\"padding-left: 30px\">Set-EqlVolume -VolumeName $VolName -OnlineStatus offline<\/p>\n<p style=\"padding-left: 30px\">Remove-EqlVolume -VolumeName $VolName &ndash;Force<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2742.san-8.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2742.san-8.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Using the <b>&ndash;Force<\/b> parameter in the previous script prevents the following confirmation message from being displayed. Use extreme caution when using this parameter; otherwise it could create an RGE.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4035.san-9.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4035.san-9.jpg\" alt=\"Image of message\" title=\"Image of message\" \/><\/a><\/p>\n<p>Check the firmware version on an EqualLogic PS Series SAN as follows:<\/p>\n<p style=\"padding-left: 30px\">Get-EqlMember &ndash;GroupAddress $GrpAddr |<\/p>\n<p style=\"padding-left: 30px\">Select-Object MemberName, FirmwareVersion | Format-Table -AutoSize<span style=\"line-height: 0px\"><\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2018.san-10.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2018.san-10.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Last but not least, remember to disconnect from the SAN when you&rsquo;re finished:<\/p>\n<p style=\"padding-left: 30px\">Disconnect-EqlGroup -GroupAddress $GrpAddr<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3073.san-11.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3073.san-11.jpg\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>The <a href=\"http:\/\/gallery.technet.microsoft.com\/scriptcenter\/Managing-an-EqualLogic-PS-9f5b0589\" target=\"_blank\">full script<\/a> can be found in the Script Center Repository.<\/p>\n<p>~Mike<\/p>\n<p>Thank you, Mike for another great blog showing us the various uses of Windows PowerShell. Join me tomorrow for a great guest blog about Windows PowerShell and SQL Server by guest blogger, Luarte Jr.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Guest blogger, Mike Robbins, talks about using Windows PowerShell to manage an EqualLogic SAN. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a returning guest blogger, Mike F. Robbins, who will talk about Managing an EqualLogic PS Series storage area network with PowerShell. Now, here is Mike&#8230; Mike F. Robbins is an [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,344,352,3,12,45],"class_list":["post-8911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-mike-f-robbins","tag-san","tag-scripting-guy","tag-storage","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Guest blogger, Mike Robbins, talks about using Windows PowerShell to manage an EqualLogic SAN. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a returning guest blogger, Mike F. Robbins, who will talk about Managing an EqualLogic PS Series storage area network with PowerShell. Now, here is Mike&#8230; Mike F. Robbins is an [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=8911"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8911\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=8911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=8911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=8911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}