NetApp SANtricity PowerShell Toolkit

by New Contributor on ‎2014-10-09 07:19 AM

NetApp SANtricity PowerShell Toolkit

 

Manage E-Series and EF-Series storage systems using PowerShell.

 

Overview:

 

The SANtricity PowerShell Toolkit is a PowerShell module containing over 100 cmdlets enabling the storage administration of NetApp E-Series storage systems and EF- Series all-flash arrays.  The PowerShell Toolkit leverages the SANtricity Web Services Proxy to provide a distributed management solution.  The PowerShell Toolkit contains cmdlets that can monitor and manage E-Series storage systems and EF-Series flash arrays.  Use cases range from simple volume or disk monitoring to complex environment setup and tear down.  By providing a rich object model, the Toolkit provides the PowerShell scripter with a wide range of insight into the storage objects.

 

Features:

 

SANtricity PowerShell Toolkit 1.0

 

  • Installer
  • 110 cmdlets for:
    • Creating/deleting volume groups and pools
    • Creating/deleting volumes
    • Creating/deleting mirror groups, snapshots, consistency groups, etc.
    • Host configuration
    • Health and performance monitoring

Pricing:

 

There is no charge for the toolkit and no license key is required.

 

Download Software & Documentation

 

The SANtricity PowerShell Toolkit is coming soon to the NetApp Tool Chest http://mysupport.netapp.com/eservice/toolchest at mysupport.netapp.com.

Comments

I'm having trouble with this one. The example scripts don't match the cmdlets (example scripts attempt to use cmdlets that don't exist). It looks like the names of some of the cmdlets have changed since the example scripts were created. 

 

Has anyone used this toolkit with good success? 

New Contributor

Hi John - I can share some code from scripts that I have written.  Let me know if this helps.

 

I have a script I source that sets my environment.

# --------------------------------------------------------------------------- #
# This script will set an environment for testing by configuring the proxy url
# and storage array by setting some global variables. This means the
# variables are durable after running this script.
# --------------------------------------------------------------------------- #
param([string]$ArrayName="WBUC225C01", [string]$Url="https://hulquest-dev:8443/devmgr/",
[string]$user="rw", [string]$pwd="rw")

if (-not $Url.EndsWith("/")) { $Url+="/" }
$global:cred = Get-NeProxyCredential -Url $Url -ProxyUser $user -ProxyPwd $pwd

# ARVM config of MP's
$global:ss = Get-NeStorageSystem -Credential $cred |? { $_.name -eq $ArrayName }

# this is a fancy trick that allows me to specify both parameters when
# calling a cmdlet (splatting)
# Get-NeStorageSystem @c is eqal to Get-NeStorageSystem -cred $cred -SystemId $ss.id
$global:c = @{
Credential= $cred
SystemId = $ss.id
}

Write-Host "Array [$($ss.Name)] Id [$($ss.Id)]"

 

And another that (deletes) and creates volumes to be snapped with another.

# --------------------------------------------------------------------------- #
# Script that demonstrates creating snapshot volumes for thick and thin       #
# volumes of a storage configuration.                                         #
# --------------------------------------------------------------------------- #
param( [string]$ArrayName="WBUC225C01", 
       [string]$Url="https://hulquest-dev:8443/devmgr/", 
       [string]$PoolName="Disk_Pool_1",
       [ValidateRange(1,10)][int]$NumToCreate=5,[string]$user="rw",
       [string]$pwd="Infinit1"
     )

function Remove-Volumes
{
    param([switch]$Thins, [array]$List)
    $command = Get-Command Remove-NeVolume
    if ($Thins) { $command = Get-Command Remove-NeThinVolume }
    foreach ($vol in $List) 
    {
        &$command @c -ObjectId $vol.id
    }
}

function Create-Volumes
{
   param([switch]$Thins,[Parameter(Mandatory=$true)][string]$PoolId,
         [ValidateRange(1,10)][int]$NumToCreate=5
        )
    $command = Get-Command New-NeVolume
    $prefix = $ThickVolPrefix
    $parameters = @{Size=10; SegSize=512}
    $type = "Thick"
    if ($Thins) 
    { 
        $command = Get-Command New-NeThinVolume 
        $prefix = $ThinVolPrefix
        $parameters = @{VirtualSize=1; RepositorySize=4; MaximumRepositorySize=32}
        $type = "Thin"
    }
    $Numbers = @(1..$NumToCreate)
    foreach ($volNum in $Numbers) 
    {
        $vol = &$command @c -SizeUnit gb -PoolId $PoolId -Name ${prefix}${volNum} @parameters
        Write-Host -ForegroundColor Green "* * * Create - Volume [$($vol.Label)] - Type [$($type)]"
    }
}

if ($ss -eq $null) 
{ 
    .\Set-DiTEnv.ps1 -ArrayName $ArrayName -Url $Url -user $user -pwd $pwd
}

$ThickVolPrefix = "PoSH-Vol-"
$ThinVolPrefix = "PoSH-ThinVol-"

$Volumes = Get-NeVolume @c |? {$_.Label -like $ThickVolPrefix + "*" }
$ThinVolumes = Get-NeThinVolume @c |? {$_.Label -like $ThinVolPrefix + "*" } 

Remove-Volumes -List $Volumes
Remove-Volumes -Thins -List $ThinVolumes

$vg = Get-NeVolumeGroup @c |? {$_.Label -eq $PoolName}

Create-Volumes -PoolId $vg.Id -NumToCreate $NumToCreate
Create-Volumes -PoolId $vg.Id -Thins -NumToCreate $NumToCreate

 

 I think my issue is with setting the environment. For example, the first script doesn't generate any output. The write-host line at the end yeilds "Array [] Id []".

 

If I try to do a simple "Get-NeStorageSystem -Credential $cred" there is no output at all. Not even an error message. Any ideas?

New Contributor

Oh!  The cmdlets use the SANtricity WebAPI to get data about the storage systems.  Typically,  the Web API will be installed as a service, possibly on a different host, under the name NetAppWebServiceProxy

Get-Service -name NetAppWebServicesProxy

Status Name DisplayName
------ ---- -----------
Running NetAppWebServic... NetApp SANtricity Web Services Proxy

 If this service is running you can test connectivity with your browser by typing in the url http://yourHost:8080/devmgr/utils/login?uid=rw&pwd=rw or https://yourHost:8443/devmgr/utils/login?uid=rw&pwd=rw.  Once logged in, the /devmgr/v2/storage-systems endpoint will display storage systems monitored by this proxy;  for instance https://yourHost:8443/devmgr/v2/storage-systems.  If it is empty, then you can use the New-NeStorageSystem cmdlet to add a storage system to be monitored.

Yes, I have the web service running and I have confirmed that works. 

 

So I used the URL: http://yourHost:8080/devmgr/utils/login?uid=rw&pwd=rw to login. The output I get is:

{"userId":"rw","roles":["storage.rw"],"lastKnownEvent":"0","globalInventoryChangeCount":"0"}

When I hit the /devmgr/v2/storage-systems URL, I get:

[]

Now here's where I'm confused. Does this mean the web service isn't talking to the SANtricity Storage Manager? Are they completely independent of one another? I was under the impression they were. If they are not, that's fine - I'll just add the arrays via New-NeStorageSystem. If they are linked, then I guess I have some other issue.

New Contributor

The web service and SANtricity StorageManager are independent.  The web service is a proxy for storage systems and needs to be told which systems to monitor and manage.  By extension, the PowerShell cmdlets find storage systems to monitor and manage by way of the web service.   Your instincts are correct that you add storage systems to the proxy by running New-NeStorageSystem.  After running New-NeStorageSystem with a credential that points to the web service, both PowerShell session and web browsers will list the storage system(s) you add.  The addition with the cmdlet (and other web service clients) is durable so you don't have to start all of our scripts by adding all of the storage systems you want to monitor.  That is unless, of course, you want to build your scripts to work that way. Smiley Happy

Hi, 

Im trying to use the powershell toolkit and am unable to execute the first recommended command.

 

I have my webservices installed on server SJC04P1NETOP01

I have verified I can access webservices and use it regularly

 

when I installed the PowerShell ToolKit it notes: 

"To access the WebService Proxy remotely, add an extra parameter when initializing your credential for the first time. Point the parameter URL to the appropriate location when you intially run Get-NeCredential.

 

Example:

 

$esCredential = Get-NeCredential -Url http://finance.corp.com:8080/devmgr/"

 

however when I attempt to run said command:

 

PS C:\> $esCredential = Get-NeCredential -Url http://sjc04p1netop01:8080/devmgr/
Get-NeCredential : A parameter cannot be found that matches parameter name 'Url'.
At line:1 char:34
+ $esCredential = Get-NeCredential -Url http://sjc04p1netop01:8080/devm ...
+ ~~~~
+ CategoryInfo : InvalidArgument: (Smiley Happy [Get-NeCredential], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,NetApp.ESeries.PowerShell.StorageArray.GetCredential

New Contributor

Hi Jess - Thanks for the interest.  I think the instructions should reference New-NeProxyCredential.  We decided to change the noun to better reflect the credential is for the WebServices Proxy.  I applogize for the confusion and we'll add this defect to the backlog so it will be resolved.

 

Here is a sample script I use to configure my PowerShell session:

 

param([string]$ArrayName="WBUC225C01", [string]$Url="https://hulquest-dev:8443/devmgr/",
        [string]$user="rw", [string]$pwd="rw")

if (-not $Url.EndsWith("/")) { $Url+="/" }
$global:cred = Get-NeProxyCredential -Url $Url -ProxyUser $user -ProxyPwd $pwd

# ARVM config of MP's
$global:ss = Get-NeStorageSystem -Credential $cred |? { $_.name -eq $ArrayName }

# this is a fancy trick that allows me to specify both parameters when 
# calling a cmdlet (splatting)
# Get-NeStorageSystem @c is eqal to Get-NeStorageSystem -cred $cred -SystemId $ss.id
$global:c = @{
              Credential= $cred
              SystemId = $ss.id
             }

Write-Host "Array [$($ss.Name)] Id [$($ss.Id)]"

 

 

thanks 

Hi All,

 

When i try to open powershell. i am getting below cmd's only. Can anyone help on this issue.

 

PS I:\Scripting> Get-Command -Module DataONTAP

CommandType Name ModuleName
----------- ---- ----------
Alias Add-NcHostIscsiConnection DataONTAP
Alias Connect-NcHostIscsiTarget DataONTAP
Alias ConvertTo-NcLun DataONTAP
Alias ConvertTo-NcVhd DataONTAP
Alias ConvertTo-NcVhdx DataONTAP
Alias ConvertTo-NcVmdk DataONTAP
Alias Copy-NcHostFile DataONTAP
Alias Disconnect-NcHostIscsiTarget DataONTAP
Alias Dismount-NcHostVolume DataONTAP
Alias Dismount-NcVirtualDisk DataONTAP
Alias Format-NcHostVolume DataONTAP
Alias Get-NcHostDisk DataONTAP
Alias Get-NcHostFcAdapter DataONTAP
Alias Get-NcHostIscsiAdapter DataONTAP
Alias Get-NcHostIscsiSession DataONTAP
Alias Get-NcHostIscsiTarget DataONTAP
Alias Get-NcHostVolume DataONTAP
Alias Get-NcHyperV DataONTAP
Alias Get-NcVirtualDiskAlignment DataONTAP
Alias Get-NcVssProvider DataONTAP
Alias Get-NcVssSnapshot DataONTAP
Alias Get-NcVssWriter DataONTAP
Alias Initialize-NcHostDisk DataONTAP
Alias Invoke-NcHostVolumeSpaceReclaim DataONTAP
Alias Invoke-NcVirtualDiskSpaceReclaim DataONTAP
Alias Invoke-NcVssBackup DataONTAP
Alias Mount-NcHostVolume DataONTAP
Alias Mount-NcVirtualDisk DataONTAP
Alias New-NcHostVolume DataONTAP
Alias New-NcVirtualDisk DataONTAP
Alias Remove-NcHostFile DataONTAP
Alias Remove-NcHostIscsiConnection DataONTAP
Alias Remove-NcHostVolume DataONTAP
Alias Repair-NcVirtualDiskAlignment DataONTAP
Alias Restore-NcHostFile DataONTAP
Alias Set-NcHostDisk DataONTAP
Alias Set-NcHostVolumeSize DataONTAP
Alias Set-NcVirtualDiskSize DataONTAP
Alias Start-NcHostDiskRescan DataONTAP
Alias Wait-NcHostDisk DataONTAP
Function Add-NaHelpInfoUri DataONTAP

New Contributor

Hi Ravi - The result of the command you display above looks like it is from the DataONTAP PowerShell module.  It is like the ONTAP metadata is present but the assemblies are not because it lists only aliases and functions.  

 

Do you wish to use the E-Series PowerShell module or the ONTAP counterpart?  Based on this answer we'll get you set up.

 

+Kevin

I have defined all the params. I am getting error if I use get-nestoragesystem. Need help. 

 

+ $StorageSystemResponse = Get-NeStorageSystem -Credential $NECred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smiley Happy [Get-NeStorageSystem], NetAppPowerShellException
+ FullyQualifiedErrorId : parameterError,NetApp.ESeries.PowerShell.GetStorageSystem

New Contributor

Hi @frinku!  Let's start by covering a few of the basics.  Will you share the values embedded in $NECred?  We need to make sure this object has the correct url to the SANtricity WebServices Proxy.  Also, please share the versions for the SANtricity PowerShell Toolkit and WebServices Proxy?  With these data points, we'll be able to get you running cmdlets.

+Kevin

Hi @khulques, Thanks for your response to my post. I am using the correct url (tried both http  8080 & https 8443) and infact I get response when I try outside powershell. 

 

NetApp WebServices Proxy version 1.3

SANtricity OS 8.20

SANtricity PowerShell toolkit version 4.0.0

 

param ([string]$ARRAYNAME = "WVDL01",[string]$URL = "http://X.X.X.X:8080/devmgr/",[string]$USER = "rw",[string]$PWD = "rw")

$NECred = Get-NeProxyCredential -url $url -ProxyUser $USER -ProxyPwd $PWD

$StorageSystemResponse = Get-NeStorageSystem -Credential $NECred |? {$_.Name -eq $ARRAYNAME}

$C = @{
Credential = $NECred
SystemId = $StorageSystemResponse.id}

Write-Host "Array [$($StorageSystemResponse.name)] ID [$($StorageSystemResponse.id)]"

 

Hope this info helps. I have used with & without ARRAY name match conditions to $StorageSystemResponse.

 

I do not have much problems in using NetApp ONTAP modules. It is just tricky on the SANTricity modules. It will be a great help if I could get this running.

 

 

New Contributor

Ok, interesting.  Will you tell me the version of powershell?  The variable $Host will have this information.  The SANtricity toolkit needs version 3.0 that fixes several HttpClient issues.  Also, will you have a look a the web services log file and report back what is logged after the request is made from the toolkit?  The path to the file is c:/Program Files/NetApp/SANtricity Web Services Proxy/working/logs/trace.log.0.  

Hi @khulques, Sorry for the late response. 

 

The Poweshell version is 4.0. Yes, you are correct, it is not even making the url requests as I do not see any log entry in trace.log.0. if I access manually, successful entry gets logged. Which means, I should be using PS 3.0? 

New Contributor

PowerShell 4.0 is good, version 3.0 is the minimum.  

 

Now that we know the problem is isolated to your computer, there are a couple of things we can try.  First, if you can install the SANtricity toolkit on a different computer, that will give us another good data point.  The other thing to look at is the local error log.  It is not super useful but might give us another clue.  The location of the file is c:/users/<yourUser>/AppData/Roaming/NetApp/ErrorRecord.log.

 

I really appreciate your patience; we'll get this figured out.

New Contributor

 Hi,

 

I having some issues with the powershell toolkit 4.1 and need some help troubleshooting the issue.

 

I am using the powershell toolkit for the eseries.

 

 

I was successful in installing the web  proxy server for eseries

i was able to add the eseries controller through the web procxy server.

i am able to run the powershell commandlets on the web proxy server.

 

I have a second server which i am using to access the web proxy server remotely.

i have the netapp powershell toolkit installed successfully on the remote server

i was able to add the credentials for the web proxy server on my remote server successfully.

 

but when i run the powershell cmdlets i get the below error

 

PS C:\Users\Administrator> Get-Module

ModuleType Name ExportedCommands
---------- ---- ----------------
Manifest Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}


PS C:\Users\Administrator> Import-Module import-module 'C:\Program Files\NetApp\Modules\NetApp.SANtricity.PowerShell'
PS C:\Users\Administrator> import-module 'C:\Program Files\NetApp\Modules\NetApp.SANtricity.PowerShell'
PS C:\Users\Administrator> import-module 'C:\Program Files\NetApp\Modules\DataONTAP'
PS C:\Users\Administrator> param([string]$ArrayName="LABxxxxxEBLO002", [string]$Url="https://10.10.16.112:8443/devmgr/",
[string]$user="eseries", [string]$pwd="P@ssw0rd")
PS C:\Users\Administrator>
PS C:\Users\Administrator> if (-not $Url.EndsWith("/")) { $Url+="/" }
PS C:\Users\Administrator> $global:cred = Get-NeProxyCredential -Url $Url -ProxyUser $user -ProxyPwd $pwd
PS C:\Users\Administrator>
PS C:\Users\Administrator> # ARVM config of MP's
PS C:\Users\Administrator> $global:ss = Get-NeStorageSystem -Credential $cred |? { $_.name -eq $ArrayName }
PS C:\Users\Administrator>
PS C:\Users\Administrator> # this is a fancy trick that allows me to specify both parameters when
PS C:\Users\Administrator> # calling a cmdlet (splatting)
PS C:\Users\Administrator> # Get-NeStorageSystem @c is eqal to Get-NeStorageSystem -cred $cred -SystemId $ss.id
PS C:\Users\Administrator> $global:c = @{
>> Credential= $cred
>> SystemId = $ss.id
>> }
>>
PS C:\Users\Administrator> Write-Host "Array [$($ss.Name)] Id [$($ss.Id)]"
Array [LABxxxxxEBLO002] Id [c2fe32fd-393a-4b82-8205-4e4a6bdc73dc]
PS C:\Users\Administrator> Get-NeSnapshot -SystemId c2fe32fd-393a-4b82-8205-4e4a6bdc73dc
Get-NeSnapshot : A non protocol error occurred.
At line:1 char:1
+ Get-NeSnapshot -SystemId c2fe32fd-393a-4b82-8205-4e4a6bdc73dc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smiley Happy [Get-NeSnapshotImages], NetAppPowerShellException
+ FullyQualifiedErrorId : parameterError,Netapp.Santricity.PowerShell.GetSnapshotImagesCmdlet

PS C:\Users\Administrator> Get-NeAbout
Get-NeAbout : A non protocol error occurred.
At line:1 char:1
+ Get-NeAbout
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smiley Happy [Get-NeAbout], NetAppPowerShellException
+ FullyQualifiedErrorId : parameterError,Netapp.Santricity.PowerShell.GetAboutCmdlet

New Contributor
2016-02-23 15:09:34,312 INFO  [com.netapp.wfa.job.backend.JobsExecutionInterceptor] (Thread-652 (HornetQ-client-global-threads-2035890968)) Job CacheJob{, dataSourceId=DataSourceInfo{id=1, name='LOCAL E-series', connectionDetails=ConnectionDetails{id=1, ip='10.10.16.112', port=8080, userName='eseries', password='******', databaseName='null', timeoutInSeconds=600, lastUpdateTime=0}, dataProviderType=DataProviderType{id=13, productType='E-Series Web Services', productVersion='2.0', scheme='eseries'}}, schemeId=Scheme{id=7, name='eseries'}, dataSourceName='LOCAL E-series', schemeName='eseries'} started
2016-02-23 15:09:55,317 INFO  [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-21) LOCAL E-series:Getting storage system information from Web Services Proxy ...
2016-02-23 15:09:58,521 INFO  [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-28) LOCAL E-series:Getting hardware information from storage system c2fe32fd-393a-4b82-8205-4e4a6bdc73dc ...
2016-02-23 15:09:59,754 INFO  [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-29) LOCAL E-series:Getting volume group and disk pool information from storage system c2fe32fd-393a-4b82-8205-4e4a6bdc73dc ...
2016-02-23 15:09:59,941 INFO  [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-31) LOCAL E-series:Getting volume information from storage system c2fe32fd-393a-4b82-8205-4e4a6bdc73dc ...
2016-02-23 15:10:00,300 INFO  [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-1) LOCAL E-series:Getting snapshot image information from storage system c2fe32fd-393a-4b82-8205-4e4a6bdc73dc ...
2016-02-23 15:10:00,518 ERROR [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (default task-3) LOCAL E-series:ERROR: Could not get snapshot image information from E-Series Web Proxy: The term 'Get-NeSnapshot' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2016-02-23 15:10:00,643 ERROR [com.netapp.wfa.job.backend.JobsExecutionInterceptor] (Thread-652 (HornetQ-client-global-threads-2035890968)) Job CacheJob{, dataSourceId=DataSourceInfo{id=1, name='LOCAL E-series', connectionDetails=ConnectionDetails{id=1, ip='10.10.16.112', port=8080, userName='eseries', password='******', databaseName='null', timeoutInSeconds=600, lastUpdateTime=0}, dataProviderType=DataProviderType{id=13, productType='E-Series Web Services', productVersion='2.0', scheme='eseries'}}, schemeId=Scheme{id=7, name='eseries'}, dataSourceName='LOCAL E-series', schemeName='eseries'} failed: com.netapp.wfa.cache.execution.CacheException: Error running data acquisition script: ERROR: Could not get snapshot image information from E-Series Web Proxy: The term 'Get-NeSnapshot' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.