Windows Command-line Automation Techniques For EqualLogic Storage

Transcription

Technical ReportWindows Command-lineAutomation Techniques forDell EqualLogic PS Series ArraysAbstractThis Technical report will describe differentmethods of command line automation availablefor Windows and Dell EqualLogic PS Series arrays.Examples are shown with step by step buildingguides in order to help administrators create theirown customizable scripts.TR1089V1.0ii

Copyright 2013 Dell Inc. All Rights Reserved.EqualLogic is a registered trademark of Dell Inc.Dell is a trademark of Dell Inc.All trademarks and registered trademarks mentioned herein are the property of theirrespective owners.Information in this document is subject to change without notice.Dell Inc. will not be held liable for technical or editorial errors or omissions containedherein. The information in this document is subject to change.Reproduction of this document in any manner whatsoever without the writtenpermission of Dell is strictly prohibited.Authored By: Chuck FarahWWW.DELL.COM/PSseries

PrefacePS Series arrays optimize resources by automating performance and network loadbalancing. Additionally, PS Series arrays offer all-inclusive array management software,host software, and free firmware updates.AudienceThe information in this guide is intended for storage administrators.Related DocumentationFor detailed information about PS Series arrays, groups, volumes, array software, andhost software, log in to the Documentation page at the customer support site.Dell Online ServicesYou can learn about Dell products and services using this procedure:1. Visit http://www.dell.com or the URL specified in any Dell product information.2. Use the locale menu or click on the link that specifies your country or region.Dell EqualLogic Storage SolutionsTo learn more about Dell EqualLogic products and new releases being planned, visitthe Dell EqualLogic TechCenter site: http://delltechcenter.com/page/EqualLogic. Hereyou can also find articles, demos, online discussions, technical documentation, andmore details about the benefits of our product family.For an updated Dell EqualLogic compatibility list please visit the following i

Table of ContentsTable of Contents . ivRevision Information . vIntroduction . 1Executive Summary . 1Available Dell EqualLogic Automation from the command line . 1PS Series Storage automation: the Goal of this document. 2Windows PowerShell . 2PS Series Arrays PowerShell . 2Other methods of automation available with Dell PS Series Storage (these methodswill not be covered in detail in this document) . 3PS Series Arrays Group Manager CLI . 3PS Series Arrays Host Scripting Tools . 3PS Series Arrays Auto-Snapshot Manager (ASM) CLI. 3PS Series Arrays SAN Headquarters CLI. 3Windows and Dell PS Series Automation Techniques. 4Windows PowerShell ISE Setup . 4Windows PowerShell Dell EqualLogic PS Series Group Access . 10Windows PowerShell Dell EqualLogic PS Series Volume Creation and AccessAutomation .16Windows PowerShell Dell EqualLogic PS Series Volume Deletion and iSCSIConnection removal . 30Windows Server 2012 Native Windows Storage Management Automation Techniques. 39Add volumes example with native Windows Server 2012 cmdlets . 39Removing volumes with native Windows Server 2012 cmdlets . 45Conclusion . 48Appendix A: Full Script to add a volume (Windows 2008). 49Appendix B: Full Script to delete a volume (Windows 2008) . 54Appendix C: Troubleshooting Techniques . 57Appendix D: Windows 2008 Integrated Scripting Environment (ISE) setup . 59Technical Support and Customer Service . 60iv

Revision InformationThe following table describes the release history of this Technical Report.ReportDateDocument Revision1.0JuneInitial ReleaseThe following table shows the software and firmware used for the preparation of thisTechnical Report.VendorModelSoftware RevisionDellHost Integration Tools for Microsoft,includes Auto-Snapshot Manager/ME,PowerShell tools for DeV4.5, V4.6DellSAN HeadquartersV2.5, V2.6The following table lists the documents referred to in this Technical Report. All PSSeries Technical Reports are available on the Customer Support site at:support.dell.comVendorvDocument Title

Windows Command-Line Automation Techniques for Dell EqualLogic PS Series ArraysIntroductionDell PS Series Arrays provide powerful command line integration for Windows, Linuxand VMware hosts. Windows PowerShell is the robust scripting interface that will allowthe administrator to customize, automate and optimize their Dell storage operations.Dell EqualLogic PS series arrays are designed to provide simplicity, advancedintegration and automatic optimization to fully leverage the storage investment.Dell EqualLogic Host Integration Tools are available for no additional cost and includesPowerShell Commands unique to the PS Series Arrays as well as storage managementautomation through native Windows PowerShell commands for Windows Server 2012and Windows 8. This document will focus on the Windows interfaces to the PS SeriesArrays.Executive SummaryThe goal of this document is to arm the administrators with skills to help automateWindows environments attached to Dell PS Series arrays. Examples and step by stepguides are offered in this document to be used for reference or training to helpdemonstrate scripting possibilities with PS Series PowerShell commands (also knownas cmdlets). The document will describe the different forms of application interfacecommunication available for PS Series arrays as well as some useful Windows specificcommands where appropriate. All of the Dell PS Series software described in thisdocument is included with the PS Series array.Available Dell EqualLogic Automation from the command lineDell PS Series array command line application interfaces available: PS Series Group Manager CLIDell EqualLogic Host Scripting tools for Windows, Linux and UnixDell EqualLogic Host Integration Tools for Windows includes Auto-SnapshotManager/Microsoft Edition (ASM/ME) – enabling the ability to create data- andapplication-consistent Smart Copies of NTFS volumes , ando Dell EqualLogic PowerShell cmdlets specific to the PS Series.o Auto-Snapshot Manager CLISAN HQ management CLIWindows Server 2012 native PowerShell cmdlets through integration with theWindows storage architecture and Dell’s PS Series Storage ManagementProvider (SMP).In addition to the PS Series specific APIs native Windows utilities such as DISKPART orWMI provide the ability to match up operating system objects to the physicalproperties necessary to manage the Dell EqualLogic PS Series storage. For instanceDISKPART is used to format and partition iSCSI connected volumes on PS Series arraysto enable the volume for use in Windows environments.1

Windows Command-Line Automation Techniques for Dell EqualLogic PS Series ArraysPS Series Storage automation: the Goal of this documentThis document will use several examples to demonstrate building blocks for advancedautomation with Dell EqualLogic PS Series Windows PowerShell cmdlets, nativeWindows PowerShell cmdlets, Windows Management Instrumentation (WMI),DISKPART and the iSCSI command line interface (CLI) utility.The Windows PowerShell ISE scripting environment will be used to provide exampleswhich demonstrate integration with PS Series arrays. The following will be achieved inthis document:1. How to enable and configure the PowerShell environment for Windows2. How to list PS Series Array properties such as volumes, members and groupinformation from PS Series PowerShell cmdlets.3. How to create, discover, login and initialize a volume to a Windows host4. How to delete existing volumes from Windows.5. Show Windows Server 2012 native PowerShell cmdlet integrationa. Automate multiple volume creationb. Automate multiple volume deletionWindows PowerShellWindows PowerShell is quickly becoming the popular scripting tool for advancedautomation. With Windows PowerShell an Integrated Scripting Environment (ISE) isavailable to enable rapid development and debugging of the code. The scriptingenvironment includes small commands which perform specific operations known ascommand-lets (cmdlet for short). These cmdlets are the building blocks for theadvanced functionality found in modern Windows scripts today.Windows Server 2012 and Windows 8 have a Storage Management Architecturethat allows for external storage to be managed by native Windows Applications such asFile Services and Systems Center Virtual Machine Manager (SCVMM). The StorageManagement API is available for Dell EqualLogic storage with the Host IntegrationTools for Microsoft v4.5 (or higher) also known as the HIT for Microsoft. HostIntegration Tools for Microsoft v4.6 will need to be installed for full support ofSCVMM 2012 SP1.PS Series Arrays PowerShellDell EqualLogic Host Integration Tools (HIT) for Microsoft also includes a suite ofWindows PowerShell cmdlets specific to PS Series arrays. The PowerShell commandsincluded with the HIT for Microsoft adds specific PS Series Array managementfunctionality and automation to the Windows PowerShell environment. The PS SeriesPowerShell commands include advanced management and discovery of the PS seriesGroup, Member or Volume and iSCSI Sessions, Replication and Snapshots.2

Windows Command-Line Automation Techniques for Dell EqualLogic PS Series ArraysOther methods of automation available with Dell PS Series Storage (these methodswill not be covered in detail in this document)PS Series Arrays Group Manager CLIThe PS Series array may be configured or viewed through a standard Telnet/SSHsession to perform diagnostics, initial group configuration or management. The PSSeries Group Manager CLI provides typical support call initiated commands or initialsetup of the array, however further administrative tasks may be automated with theHost Scripting Tools described below. For further information please download the“Group Manager CLI Reference Guide” from the PS Series Firmware download sectionof https://eqlsupport.dell.comPS Series Arrays Host Scripting ToolsHost Scripting tools are available to issue PS Series Group Manager command lineinterface (CLI) commands from a remote host and capture the output of thecommands for further action. The Host Scripting tools are available for Windows, Linuxand UNIX. These host scripting tools allow for manipulation of the PS Series GroupManager CLI with Perl or Python scripting languages. For further information pleasedownload the “Host Scripting Tools” from the PS Series Firmware download section ofhttps://eqlsupport.dell.comPS Series Arrays Auto-Snapshot Manager (ASM) CLIDell EqualLogic Host Integration Tools for Windows with Auto-SnapshotManager/Microsoft Edition (ASM/ME) may be installed to provide full applicationconsistent snapshot capabilities. Although the ASM GUI interface provides advancedautomation functionality the ASM CLI provides an application interface to the PS Seriesarray for additional customization of Smart Copy management.Note: For Windows Smart Copy uses the PS Series arrays protection capability tocreate application consistent snapshots, clones and replicas to provide protection andrecovery of important information assets.For further information please download the “Auto-Snapshot Manager Microsoft Edition – User’s Guide” from the Host Integration Tools for Microsoft download sectionof https://eqlsupport.dell.comPS Series Arrays SAN Headquarters CLISAN Headquarters (SAN HQ) is an advanced performance, configuration and alertmonitoring system for PS Series arrays. Several tasks may be accomplished with theSAN HQ cli such as report automation, adding PS Series Groups, creating archives andexports as well as the ability to launch SAN HQ GUI with specific parameters.For further information please download the “Installation and User’s Guide” from theSAN Headquarters download section of https://eqlsupport.dell.com3

Windows Command-Line Automation Techniques for Dell EqualLogic PS Series ArraysWindows and Dell PS Series Automation TechniquesWindows PowerShell ISE SetupThe PowerShell Integrated Scripting Environment (ISE) will be used to enabledevelopment, testing and debugging of PowerShell scripts or modules to configureDell EqualLogic Storage to Windows. Alternatively the Dell PS Series PowerShell Toolsinterface may be used, however this document will focus on the use of the WindowsIntegrated Scripting Environment (ISE) which is included with Windows 2008 R2 orhigher (Please see Appendix D for more information). All the examples below usePowerShell v2.0 available with Windows 2008 R2 SP1 and PowerShell v3.0 forWindows Server 2012 and Windows 8.Download and install the Host Integration Tool for Microsoft v4.5 or higher fromhttps://eqlsupport.dell.com. The kit will include the Dell EqualLogic PowerShell ToolsReference Guide v4.5 which will provide detailed information about each cmdlet.Pre-requisites: Windows PowerShell Integrated Scripting Environment (ISE)Please see Appendix D for feature information on Windows 2008. Host Integration Tools for Microsoft Please refer to the Dell EqualLogic PowerShell Tools Reference Guidehttps://eqlsupport.dell.comWarning:The examples that follow will make changes to your systems and should bethoroughly tested and modified in a development environment prior to moving toproduction. Please use the examples as a reference and be aware that these scripts areprovided as is without warranty of any kind. The PS Series PowerShell cmdlet libraryare fully supported through standard Dell agreements.4

Windows PowerShell ISE Environment setupTo setup up our PowerShell Environment the following will need to be performed1. As indicated above download and Install Dell EqualLogic Host Integration Tools forMicrosoft (HIT/Microsoft v4.5 or higher)2. Add the Windows PowerShell ISE feature on Windows 2008 hostsPlease see Appendix D for more information.3. Enable Microsoft Windows PowerShell script execution4. Customize the profile for Windows PowerShell ISE5. Include the Dell EqualLogic PowerShell cmdlets module in the WindowsPowerShell ISEGraphical representation of the steps involved. The green will indicate tasks that arecompleted while the highlighted square will indicate the current process.StartInstall HITforMicrosoft*Customize ISE startupprofile5AddWindowsISE*Save andTest Logicmodules

Windows PowerShell ISE Environment setupStep – By – Step Setup for Windows 2008 and Windows 2012/Windows 8StartInstall utionNote: HIT/Microsoft and Windows PowerShell ISE should be setup prior to this step inthe instructions1. Enable Windows PowerShell execution.By default the execution policy is set to “Restricted” which means you will not beable to execute any PowerShell Scripts.a. Open a Windows PowerShell consoleWindows Sever 2012\Windows 8Server Manager- Tools- Windows PowerShellWindows 2008/Windows 7All Programs- Accessories- Windows PowerShell- Windows PowerShellb. Determine execution policy: Enter at the command linePS C:\ Get-ExecutionPolicyc. If the execution policy is “Restricted” then enter :PS C:\ Set-ExecutionPolicy RemoteSigned2. Setup the Windows ISE for PS Series cmdlets module.a. Open Windows ISEWindows Server 2012/Windows 8Server Manager- Tools- Windows PowerShell ISEWindows 2008/Windows 7All Programs- Accessories- Windows PowerShell- Windows PowerShell ISE(Right mouse – Run as administrator)6

Windows PowerShell ISE Environment setupStartInstall utionImportEqualLogicmodulesb. Import the PS tools (PowerShell cmdlets) module per session:PS C:\ import-module –name EqualLogic HIT Installpath \EqlPSTools.dllExample: import-module –name �Test the access and list PS Series cmdlets:PS C:\ Get-Command –Module EqlPSToolsExample partial output:PS C:\ Get-Command -module eName---------EqlPSToolsEqlPSToolsBelow are the guidelines to import the PS Tools (PowerShell cmdlets)permanently and provide persistence between Windows PowerShell ISEsessions.c. Create a profile or Open the appropriate profile script: for our example wewill create a profile for all users and all hosts on this machined. Edit the profile to include an environmental variable to the path and theimport the EqlPSTools module.7

Windows PowerShell ISE Environment setupStartISESetupEnableExecutionCustomizeISE Startupprofilee. Create Profile:Copy the code below to a new PowerShell document and save asCreateMyProfile.ps1#########################if (!(test-path profile.AllUsersAllHosts)){new-item -type file -path profile.AllUsersAllHosts -force}f.Execute the PowerShell script from the command prompt:PS C: .\CreateMyProfile.ps1Note: The “.\” (dot slash) prefix is a Microsoft security measure to ensure theauthorized user is running the script.g. Edit the profile to add the module:PS C: notepad profile.AllUsersAllHostsh. Add these lines with the appropriate locations for the install path: env:PSModulePath env:PSModulePath Import-Module –name “C:\Program Files\EqualLogic\bin\EqlPSTools.dll”Note: Be sure the install path is correct. Further customization is alsoavailable such as “CD” to a default specific working directory.8

Windows PowerShell ISE Environment setupStartISESetupCustomizeISE Startupi.Save the profile, Exit the ISE and restart.j.Once the Windows ISE is re-started test with:Save andTest profileEndPS C:\ Get-Command –Module eName---------EqlPSToolsEqlPSToolsNote: These guidelines will import the EqualLogic PS Tools (PowerShellcmdlets) permanently and provide persistence between Windows PowerShellISE sessions.See: http://msdn.microsoft.com/en-us/library/dd878326(v vs.85).aspx for moreinformation.Tip: Be sure the install path is correct. Further customization is also availablesuch as “CD” to a default specific working directory.Example of a Profile Script:9

Windows PowerShell Dell EqualLogic PS Series Group AccessWindows PowerShell Dell EqualLogic PS Series Group AccessBefore being able to execute PowerShell cmdlets that will manage PS Series storagethe PS Series Group(s) will need to be registered and connected. This may be achievedthrough Auto-Snapshot Manager/Microsoft Edition or through the provided PowerShellcmdlets. We will use the PowerShell cmdlets option for this example. See the “DellEqualLogic PowerShell Tools v4.5 Quick Reference” for more information.The Following steps will be performed: Check for previous connection to the PS Series GroupsEstablish new group access if neededConnect to the PS series groupsTest ConnectionStart10Set NewAccessConnect tothe PS GroupTestConnectionEnd

Windows PowerShell Dell EqualLogic PS Series Group AccessStep – By – Step PS Series Group AccessStartSet NewAccessConnect tothe PS GroupTestConnectionEnd1. Start the Windows PowerShell ISEWindows Server 2012/Windows 8Server Manager- Tools- Windows PowerShell ISEWindows 2008/ Windows 7All Programs- Accessories- Windows PowerShell- Windows PowerShell ISE2. Check for previous PS Series Group access :Windows Server 2012PS C:\ Get-StorageSubSystemThis command uses the SMP integration in Windows Server 2012.PS C:\ Get-StorageSubSystemWARNING: No EqualLogic PS Groups configured on this host. Please use EqualLogicPowerShell Tools or Auto-Snapshot Manager to configure PS Group access.Windows 2008/ Windows 7PS C:\ Get-EqlGroupAccessPS C:\ Get-EqlGroupAccessWARNING: No connection exists to any Group.Note: Group access may have been established during the installation of theHost Integration Tools for Microsoft. Multiple Groups may be registered andconnected to a single host.All of the commands listed for Windows 2008 will work as well for WindowsServer 2012.3. Register PS Series Group access (not necessary if already configured but willneed to verify connection in step 5.).Syntax:New-EqlGroupAccess –Groupname groupname -GroupWKaddress WellKnownIPaddress -username DOMAIN \ username –password password -VSSUserName chapuserforvss VSSPassword chappassword Example:PS C:\ New-EqlGroupAccess -GroupName tekmktlab -GroupWKAddress 10.10.5.50 Username grpadmin -Password eqleql -VSSUsername eqlsan -VSSPassword equallogic123Successfully connected to the group 'tekmktlab'Note: New-EqlGroupAccess will register the array and connect. This is thepreferred method for connecting to the array as opposed to Connect-EqlGroup.11

Windows PowerShell Dell EqualLogic PS Series Group AccessBelow screen captures will indicate how to locate the input parameters fromthe EqualLogic PS Series Group Manager User Interface-GroupName-GroupWKAddressNote: -MgmtWKAddress may beused if a management networkis used on this Group-VSSUserName-VSSPassword12

Windows PowerShell Dell EqualLogic PS Series Group AccessStartSet NewAccessConnect tothe PS GroupTestConnectionEnd4. Check for all PS Series access and Connection informationPS C:\Get-EqlGroupAccess Format-Table –property GroupName, SessionIDIf the SessionID does not show as disconnected please continue to Step 6.PS C:\ Get-EqlGroupAccess format-Table -property groupname,sessionid -AutoSizeGroupName SessionId--------- --------TR2ProdGrp 64ED2A45484434AA50FB440000009035Note: a SessionId populated indicates a successful connection to the Group.The Format-Table cmdlet allows for column selection and output formatcustomization.Multiple Groups may be connected to this Server (see example below):PS C:\ Get-EqlGroupAccess Format-Table -Property GroupName,SessionID 0D4057EA9D5A4000000D086To select just an individual Group use the following cmdlet:PS C:\ Get-EqlGroupAccess Where-Object { .GroupName -eq 'tekmktlab'} FormatTable -Property GroupName,SessionID -AutosizeGroupName SessionId--------- --------tekmktlab 6090A02860F2A2B53C6F1483020020C7The Where-Object cmdlet is a handy way to filter selections.5. *** Only Connect if the Group is currently disconnected ***PS C:\Get-EqlGroupAccess Format-Table –property GroupName, SessionIDPS C:\ get-eqlgroupaccess ft -property groupname,sessionid -AutoSizeGroupName SessionId--------- --------TR2ProdGrp disconnected If disconnected Connect to the PS Series arrayPS C:\ Set-EqlGroupAccess -GroupName TR2ProdGrp -UserName grpadmin -Password eqleqlSuccessfully connected to the group 'TR2ProdGrp'The success statement indicates that the credentials and connectioninformation is correct. The Set-EqlGroupAccess is the preferred method to reestablish connections if needed.Note: In some cases you may need to re-register with the “RemoveEqlGroupAccess –GroupName GroupName” and then “New-EqlGroupAccess”.13

Windows PowerShell Dell EqualLogic PS Series Group AccessStartSet NewAccessConnect tothe PS GroupTestConnection6. To test connection and access to the Group:PS C:\ ed06/11/1310:22:44america New York10 Gigabit Storage e@dell.com;disabledenabledenabledTechMkt led21disabledEnabledDisabledDisabledNote: This connection may also be shown with the native Windows Server2012 PowerShell cmdlets “Get-StorageSubsystem” as well as the AutoSnapShot/ME GUI.14End

Windows PowerShell Dell EqualLogic PS Series Group AccessNote: Auto-Snapshot Manager/Microsoft Edition PS Group Access example.Tip: Any command may be explained with Get-Help cmdlet options whereoptions may be –detailed, -examples etc.15

Windows PowerShell Dell EqualLogic PS Series Volume Creation and AccessAutomationWindows PowerShell Dell EqualLogic PS Series Volume Creation and AccessAutomationIn this section we will demonstrate how to create a new volume, enable access andconnect an iSCSI volume as well as format, partition and bring the volume online toWindows. This is the method required for Windows operating systems prior toWindows Server 2012 or Windows 8. Windows Server 2012 and Windows 8 includeadditional integration and capabilities with Dell EqualLogic storage. However thebelow scripts will work with Windows Server 2012, Windows 8 and Windows 2008.The following example will use the Dell PS Series PowerShell cmdlets, Windowsnative PowerShell cmdlets, Windows iSCSI CLI (a Windows utility to manage iSCSIsessions), Windows Management Interface (WMI) as well as the DISKPART utility forWindows.To add an EqualLogic volume through a command interface the following steps will beexecuted.1. Create the new volume on the PS Series Array through the PS Series PowerShellcmdlets.2. Enable the Access Control List (ACL) for that volume to the host initiator (toprovide access to the volume through the iSCSI network).3. Connect the volume created on the PS Series array to the host with theWindows iSCSI CLI (iscsicli.exe).4. Determine the Physical Disk just created (from the WMI interface for Windows2008 R2)5. Bring the new volume online with the Windows DISKPART utility (Windows2008) which will format a new NTFS volume assigned to the next available driveletter.StartCreatenew EQLvolumeBringiSCSIvolumeonline16EnableAccessto theVolumeGetPhysicalDiskNumberConnectto theVolumePartition,assign andFormat anewVolumeEnd

Windows PowerShell Dell EqualLogic PS Series Volume Creation and AccessAutomationStep – By – Step Pre-Windows Server 2012We will test each of these steps individually then provide a complete PowerShell scriptfor latter modification and automation. See Appendix A for the full script.StartLaunch ISETestConnectionEndTo complete this exercise please perform the following:1. Launch the PowerShell ISE (Note: if you followed the steps to initialize yourPowerShell environment you will not need to import the PS Series cmdlets)2. Connect to the appropriate PS Series Group if needed. See the PS Series Groupaccess section.To test connection and access to the Group:PS C:\ Get-EqlGroupAccess Format-Table –Property GroupName, SessionIDNote: If this command does no

The kit will include the Dell EqualLogic PowerShell Tools Reference Guide v4.5 which will provide detailed information about each cmdlet. Pre-requisites: Windows PowerShell Integrated Scripting Environment (ISE) Please see Appendix D for feature information on Windows 2008.