Getting Started with the Data ONTAP Power Shell

  • Slides: 27
Download presentation
Getting Started with the Data ONTAP Power. Shell Toolkit Leverage Microsoft Power. Shell for

Getting Started with the Data ONTAP Power. Shell Toolkit Leverage Microsoft Power. Shell for (almost) all your Data ONTAP management needs Slides courtesy of Jason Cole

Data ONTAP Power. Shell Toolkit ¡Maintained by the Net. App Management Framework Integration Team.

Data ONTAP Power. Shell Toolkit ¡Maintained by the Net. App Management Framework Integration Team. ¡Provides a Power. Shell wrapper around the Net. App Manage. ONTAP SDK. ¡Free! (NOW login required for download) ¡Posted to the communities website. ¡ 528 cmdlets in version 1. 5. 0. ¡Near 100% coverage for Data ONTAP API set. ¡Some host-side, storage-centric cmdlets. 2

What do you need to get started? ¡Windows Management Framework – Win. RM 2.

What do you need to get started? ¡Windows Management Framework – Win. RM 2. 0 (Windows Remote Management) – Powershell 2. 0 ¡Already installed on Windows Server 2008 R 2 and Windows 7 – Can be installed on Windows Server 2008 (SP 1), Server 2003 (SP 2), Vista (SP 1 and SP 2) and XP (SP 3) ¡Data ONTAP Power. Shell Toolkit 3

Installing the Power. Shell Module ¡ Unzip the Data ONTAP Power. Shell toolkit to

Installing the Power. Shell Module ¡ Unzip the Data ONTAP Power. Shell toolkit to a folder under one of these locations – User specific location (only available to the currently logged on user) ¡ %USERPROFILE%DocumentsWindows. Power. ShellModules – System location (available to all users) ¡ %SYSTEMROOT%system 32Windows. Power. Shellv 1. 0Modules ¡ Or use the provided Install. ps 1 script, which will unzip and copy the files. The script will offer to copy to each location in %PSModule. Path% in turn; it’s simplest to allow it to install to just one of those (the system location so it’s available to all users). ¡ Open the Windows Power. Shell and verify the module exists – PS C: > Get-Module –listavailable ¡ Import the module – PS C: > Import-Module Data. ONTAP 4

Installation gotchas ¡If you prefer to add the module by unzipping the Data. ONTAP.

Installation gotchas ¡If you prefer to add the module by unzipping the Data. ONTAP. zip file manually, you may need to clear the security attribute first in the file’s Properties window. ¡On some versions of Windows, you may need to add the feature “. NET Framework 3. 5. 1 Features”. Net. App Confidential - Internal Use Only 5

Setting up your Power. Shell profile ¡ This is an optional step ¡ Power.

Setting up your Power. Shell profile ¡ This is an optional step ¡ Power. Shell profiles are used to add aliases, functions and variables to each session ¡ There are 4 locations that you can save a profile to and the below steps describe the creation of a user specific profile – To display the path to the profile ¡ PS C: > $profile – To determine if the profile exists (returns True if file exists) ¡ PS C: > test-path $profile – To create a new profile if one does not exist ¡ PS C: > New-Item –path $profile –itemtype file –force – To edit the profile ¡ PS C: > notepad $profile – Add this line into the profile to load the Data. ONTAP module each time the shell is opened ¡ PS C: > Import-Module Data. ONTAP 6

How to find help ¡To view the list of cmdlets available to you –

How to find help ¡To view the list of cmdlets available to you – PS C: > Get-Na. Help – Use -Category switch and/or wildcards to narrow the results. ¡To view the full HTML help – PS C: > Show-Na. Help ¡To see cmdlet specific help – PS C: > Get-Help Get-Na. Vol ¡More detailed help can be displayed – PS C: > Get-Help Get-Na. Vol –Full ¡Every cmdlet has at least one real usage example in its online help. 7

Basic usage examples 8

Basic usage examples 8

You must first connect to a controller ¡ The coolest part about this is

You must first connect to a controller ¡ The coolest part about this is that unless you specify credentials it will attempt to authenticate with your current credentials. – Uses RPC to connect to the controllers (by default) – Also supports HTTP/HTTPS connections 9

Gather basic info from the controller 10

Gather basic info from the controller 10

Gather the list of volumes 11

Gather the list of volumes 11

Get more volume information 12

Get more volume information 12

Volume Snap. Shot and Snap. Reserve Info 13

Volume Snap. Shot and Snap. Reserve Info 13

Add and remove licenses 14

Add and remove licenses 14

Set Snap. Shot schedules 15

Set Snap. Shot schedules 15

Set Snap. Shot reserve 16

Set Snap. Shot reserve 16

Manipulate CIFS shares 17

Manipulate CIFS shares 17

Monitor performance 18

Monitor performance 18

More advanced examples 19

More advanced examples 19

Perform command on multiple controllers 20

Perform command on multiple controllers 20

Get the Snap. Shot Delta for all volumes on all controllers (this is for

Get the Snap. Shot Delta for all volumes on all controllers (this is for you Capt. Kirk!) ¡Would I actually do it this way? Absolutely not! But it works! 21

Additional notes 22

Additional notes 22

Miscellaneous recommendations ¡ You should modify your default script security settings before you get

Miscellaneous recommendations ¡ You should modify your default script security settings before you get too far. The default is highly secure (‘Restricted’). – Current setting: PS C: > Get-Execution. Policy – PS C: > Set-Execution. Policy Remote. Signed ¡ Instead of calling out the root volume as “vol 0” (which may not always be its name) use the Get-Na. Vol. Root cmdlet. – PS C: > Get-Na. Vol | where {$_. Name –ne (Get-Na. Vol. Root). Name} | Get-Na. Snap. Shot. Reserve ¡ In many cases, positional parameters are supported, so you don’t have to type the parameter name (such as –Name). Review the Get-Help for the cmdlet to see if it is required if you want to make the command more concise. ¡ Many cmdlets that retrieve info support wildcards, even if the underlying Data ONTAP API does not. 23

Slightly better ways to do stuff ¡ Instead of defining each controller from the

Slightly better ways to do stuff ¡ Instead of defining each controller from the CLI ($node 1 = Connect-Na. Controller …), you could add all the hostnames into a text file and read them in. – foreach ($filer in Get-Content C: filers. txt) { Connect. Na. Controller -Name $filer | …. . } ¡ Even better would be to populate the hostnames into an XML structure that could be organized by site. – I’m thinking of NMCI here, where you could then operate on a set of hostnames at a particular site only. ¡ [xml]$s = Get-Content C: filers. xml ¡ $s. NMCI. Host | where {$_. Site –eq “WNYD”} | …. 24

Other ideas ¡Checking all the Snap. Mirror lag times and outputting only those over

Other ideas ¡Checking all the Snap. Mirror lag times and outputting only those over a certain threshold ¡Performing a disk zero spares ¡Configuring options to be consistent across the enterprise (NTP, WAFL, CIFS, etc) ¡Turning on and configuring dedupe ¡Scripting controller rollouts ¡Monitoring for performance issues ¡…. (See the Toolkit community for more script ideas) 25

Questions? Post your ideas and questions on the Net. App Communities page where you

Questions? Post your ideas and questions on the Net. App Communities page where you got the Toolkit! 26

27

27