NetAppDocs PowerShell Module

Usage Examples

Below are a few basic examples outlining the workflow for this module. They highlight only the basic set of parameters for each function and more detailed usage information can be found on the help pages for the individual functions.


Live Data Collection

ONTAP (Cluster View)

  • Gather data for a single cluster

    This example shows how to gather the data from a single cluster (named 'ntap-cluster') and exports the raw data file.

    PS> Get-NtapClusterData -Name ntap-cluster | Export-Clixml -Path 'D:\Output\ntap-cluster.xml'
  • Gather data from multiple clusters (single output file)

    This example gathers the data from multiple clusters and outputs to a single XML file.

    PS> Get-NtapClusterData -Name ntap-cluster1, ntap-cluster2 | Export-Clixml -Path 'D:\Output\ntap-clusters.xml'
  • Gather data from multiple clusters (multiple output files)

    This example gathers the data from multiple clusters and outputs to individual XML files.

    PS> Get-NtapClusterData -Name ntap-cluster1, ntap-cluster2 | ForEach-Object { $_ | Export-Clixml -Path "D:\Output\$( $_.SystemName ).xml" }
  • Perform collection and documentation generation in a single step

    This example shows how to gather the data from a single cluster and output the documents in a single step.

    PS> Get-NtapClusterData -Name cluster1 | Format-NtapClusterData | Out-NtapDocument -WordFile 'D:\Output\cluster1.Docx' -ExcelFile 'D:\Output\cluster1.xlsx'
  • Gather data from multiple clusters (single output file)

    This example gathers the data from multiple clusters and outputs to a single XML file.

    PS> Get-NtapClusterData -Name ntap-cluster1, ntap-cluster2 | Export-Clixml -Path 'D:\Output\ntap-clusters.xml'
  • Collect in one step and generate documentation in a second step

    This example is useful if you need to quickly gather the data from the storage system(s) and then generate the documentation at a later time.

    • Collect from a single storage system

      PS> Get-NtapClusterData -Name cluster1 | Export-Clixml -Path 'D:\Output\cluster1_raw.xml'
    • Collect from multiple storage systems

      PS> 'cluster1', 'cluster2' | ForEach-Object {
          $_ | Get-NtapClusterData | Export-Clixml -Path "D:\Output\$( $_ )_raw.xml"
      }
    • Generate documentation

      PS> Get-ChildItem -Path 'D:\Output' -Filter *_raw.xml | Format-NtapClusterData | Out-NtapDocument -WordFile 'D:\Output\Site.Docx' -ExcelFile 'D:\Output\Site.xlsx'

ONTAP (SVM View)

  • Gather data for all SVMs in the cluster

    This example gathers the SVM specific information for each Data SVM directly from an ONTAP system and exports the raw data file.

    PS> Get-NtapVserverData -ClusterName cluster1 | Export-Clixml -Path 'D:\Output\All_Vservers.xml'
  • Gather data for specified SVMs in the cluster

    This example gathers the SVM specific information for the Data SVMs specified directly from an ONTAP system and exports the raw data file.

    PS> Get-NtapVserverData -Name vs_nfs, vs_cifs -ClusterName cluster1 | Export-Clixml -Path 'D:\Output\NAS_Vservers.xml'
  • Perform collection and documentation generation in a single step for all SVMs

    This example gathers the SVM data for all SVMs directly from an ONTAP system and generates the documents required.

    PS> Get-NtapVserverData -ClusterName cluster1 | Format-NtapVserverData | Out-NtapDocument -WordFile 'D:\Output\All_SVMs.docx' -ExcelFile 'D:\Output\All_SVMs.xlsx'
  • Perform collection and documentation generation in a single step for specific SVMs

    This example gathers the SVM data for specific SVMs directly from an ONTAP system and generates the documents required.

    PS> Get-NtapVserverData -Name vs_nfs, vs_cifs -ClusterName cluster1 | Format-NtapVserverData | Out-NtapDocument -WordFile 'D:\Output\Nas_SVMs.docx' -ExcelFile 'D:\Output\Nas_SVMs.xlsx'
  • Create SVM specific documentation from data created by Get-NtapClusterData

    This example shows how to gather the data one time from the cluster and provide both cluster documentation and the SVM-specific data.

    • Gather the raw data:

      PS> Get-NtapClusterData -Name cluster1 | Export-Clixml -Path 'D:\cluster1_raw.xml'
    • Create the Cluster specific documentation:

      PS> Get-ChildItem -Path 'D:\cluster1_raw.xml' | Format-NtapClusterData | Out-NtapDocument -ExcelFile 'D:\Output\cluster1_data.xlsx'
    • Create the SVM specific documentation:

      PS> Get-ChildItem -Path 'D:\cluster1_raw.xml' | ConvertTo-NtapVserverData | Format-NtapVserverData | Out-NtapDocument -ExcelFile 'D:\Output\All_SVMs-from_ClusterData.xlsx'

7-Mode

  • Gather data for 7-Mode controllers (single output file)

    This example shows how to gather the data from 2 controllers and exports the raw data file.

    PS> Get-NtapFilerData -Name controller1, controller2 | Export-Clixml -Path 'D:\Output\7mode_controllers.xml'
  • Gather data for 7-Mode controllers (multiple output files)

    Same as the previous example, but with multiple output files.

    PS> Get-NtapFilerData -Name controller1, controller2 | ForEach-Object { $_ | Export-Clixml D":\Output\$( $_.SystemName ).xml" }
  • Perform collection and documentation generation in a single step

    This example shows how to gather the data from two controllers and output the documents in a single step.

    PS> Get-NtapFilerData -Name controller1, controller2 | Format-NtapFilerData | Out-NtapDocument -WordFile 'D:\Output\Site.Docx' -ExcelFile 'D:\Output\Site.xlsx'
  • Collect in one step (raw XML output) and generate documentation in a second step

    This example is useful if you need to quickly gather the data from the storage system(s) and then generate the documentation at a later time.

    • Collect from multiple storage systems

      PS> Get-NtapFilerData -Name controller1, controller2 | Export-Clixml -Path 'D:\Output\7Mode-Controllers_raw.xml'
    • Generate documentation

      PS> Get-ChildItem -Path 'D:\Output\7Mode-Controllers_raw.xml' | Format-NtapFilerData | Out-NtapDocument -WordFile 'D:\Output\Site.Docx' -ExcelFile 'D:\Output\Site.xlsx'

ASUP Data Collection

By default, the Get-NtapClusterAsupData and Get-NtapFilerAsupData functions will search for the latest weekly ASUP set. You can also search for the latest 'user_triggered' ASUP set using the -AsupSubject user_triggered parameter. To locate an ASUP set other than the latest you must either use the Find-NtapClusterAsup/Find-NtapFilerAsup functions, or supply the actual ASUPID's (these can be found using NTSTP/SmartSolve).

Note: SSO login credentials are required for ASUP access (as of version 3.1). You will be prompted for these credentials (once per PowerShell session) prior to using any of the ASUP Find-*/Get-* functions. You can also cache the credentials manually by using the Invoke-SsoLogin function.

ONTAP ASUP

  • Perform collection and documentation generation in a single step

    This example shows how to gather the data from a single cluster and output the documents in a single step.

    PS> Get-NtapClusterAsupData -Cluster den-cdot:394e82bf-485c-11e2-86b3-123478563412 | Format-NtapClusterData | Out-NtapDocument -WordFile 'D:\Output\den-cdot_Asup.Docx' -ExcelFile 'D:\Output\den-cdot_Asup.xlsx'
  • Collect in one step (raw XML output) and generate documentation in a second step

    This example is useful if you need to quickly gather the data from the storage system(s) and then generate the documentation at a later time.

    • Collect from a single storage system

      PS> Get-NtapClusterAsupData -Cluster den-cdot:394e82bf-485c-11e2-86b3-123478563412 | Export-Clixml -Path 'D:\Output\den-cdot_Asup-raw.xml'
    • Collect from multiple storage systems

      PS> cluster1:394e82bf-485c-11e2-86b3-123478563412, cluster2:dc1505b8-b993-11e3-9ee7-123478563412 | ForEach-Object {
          $_ | Get-NtapClusterAsupData | Export-Clixml -Path "D:\Output\$( ($_ -split ':')[0] )_Asup-raw.xml"
      }
    • Generate documentation

      PS> Get-ChildItem -Path 'D:\Output' -Filter *_Asup-raw.xml | Format-NtapClusterData | Out-NtapDocument -WordFile 'D:\Output\Site_Asup.Docx' -ExcelFile 'D:\Output\Site_Asup.xlsx'
  • Find the Cluster Identifier and perform the data collection

    If you don't know the Cluster Identifier (UUID) you will need to search the ASUP database for it using the serial number from one of the nodes in the cluster. You can then gather the data as in the previous examples.

  • Search for the Cluster UUID

    PS> Find-NtapAsupClusterId -ClusterName den-cdot -NodeSerialNumber 700000454908
    
    cluster_name       : den-cdot
    cluster_identifier : 394e82bf-485c-11e2-86b3-123478563412
    sys_serial_no      : 700000454908
    sys_model          : FAS6080
    sys_operating_mode : Cluster-Mode
    sys_version        : 8.2.2P2
    
  • Collect from the storage system using the cluster_identifer

    PS> Get-NtapClusterAsupData -Cluster den-cdot:394e82bf-485c-11e2-86b3-123478563412 | Export-Clixml -Path 'D:\Output\den-cdot-Asup_raw.xml'
  • Find the first validated weekly ASUP set using specific dates and perform the data collection

    This example highlights how to search the ASUP database using specific dates and performing the data collection.

    PS> Find-NtapClusterAsup -Cluster den-cdot:394e82bf-485c-11e2-86b3-123478563412 -StartDate 2014-12-01 -EndDate 2014-12-15 | Get-NtapClusterAsupData | Export-Clixml -Path 'D:\Output\den-cdot-Asup_raw.xml'

7-Mode ASUP

  • Perform collection and documentation generation in a single step

    This example shows how to gather the data from two controllers and output the documents in a single step.

    PS> Get-NtapFilerAsupData -System mtharvard:30020945!mtmassive:30020946 | Format-NtapFilerData | Out-NtapDocument -WordFile 'D:\Output\mtharvard-mtmassive_Asup.Docx' -ExcelFile 'D:\Output\mtharvard-mtmassive_Asup.xlsx'
  • Collect in one step (raw XML output) and generate documentation in a second step

    This example is useful if you need to quickly gather the data from the storage system(s) and then generate the documentation at a later time.

  • Collect from multiple storage systems

    PS> Get-NtapFilerAsupData -System mtharvard:30020945!mtmassive:30020946 | Export-Clixml -Path 'D:\Output\mtharvard-mtmassive_Asup-raw.xml'
  • Generate documentation

    PS> Get-ChildItem -Path 'D:\Output\mtharvard-mtmassive_Asup-raw.xml' | Format-NtapFilerData | Out-NtapDocument -WordFile 'D:\Output\mtharvard-mtmassive_Asup.docx' -ExcelFile 'D:\Output\mtharvard-mtmassive_Asup.xlsx'
  • Find the first validated weekly ASUP set using specific dates and perform the data collection

    PS> Find-NtapFilerAsup -System mtharvard:30020945!mtmassive:30020946 -StartDate 10-15-2014 -EndDate 11-15-2014 | Get-NtapFilerAsupData | Export-Clixml -Path 'D:\Output\mtharvard-mtmassive_Asup-raw.xml'

Creating Diff Reports

In order to create diff reports, the data from the Format-Ntap*Data functions must be saved as .XML files through the Out-NtapDocument function using the -XmlFile parameter. This functionality is only available starting with NetAppDocs v2.6.0.

PS> Get-NtapClusterData -Name den-cdot | Format-NtapClusterData | Out-NtapDocument -XmlFile D:\den-cdot_01-2014.xml
PS> Get-NtapClusterData -Name den-cdot | Format-NtapClusterData | Out-NtapDocument -XmlFile D:\den-cdot_02-2014.xml
PS> Compare-NtapDocsData -XmlFile1 D:\den-cdot_01-2014.xml -XmlFile2 D:\den-cdot_02-2014.xml | Out-NtapDocument -ExcelFile D:\den-cdot_DiffReport.xlsx

Data Sanitization

Each of the Format-Ntap*Data functions support a -SanitizeLevel parameter. Additional information for the data sanitization options can be found in the individual Format-Ntap*Data functions help pages.


Using Alternate Credentials

All of the previous examples assume that the user account running the commands has administrative access to the controllers. If that is not the case, Get-NtapFilerData, Get-NtapClusterData and Get-NtapVserverData will accept alternate credentials through the -Credential parameter.

If the user account credentials will be the same across all controllers or clusters (for instance, 'root'), then you can prompt for the credentials once and those credentials will be used for each connection.

  • 7-Mode

    PS> $Credential = Get-Credential
    PS> Get-NtapFilerData -Name controller1, controller2 -Credential $Credential | ...
  • ONTAP

    PS> $Credential = Get-Credential
    PS> Get-NtapClusterData -Name cluster1, cluster2 -Credential $Credential | ...
  • ONTAP (SVM)

    PS> $Credential = Get-Credential
    PS> Get-NtapVserverData -ClusterName cluster1 -Credential $Credential | ...

If, however, each controller or cluster has different credentials, then there is a mechanism within the NetApp ONTAP PowerShell Toolkit for caching those credentials. It is possible to save the credential for the current user or for all users (-SystemScope parameter). Upon connection to a controller, the credentials cache will be queried for an entry to the controller specified.

  • 7-Mode

    PS> Add-NaCredential -Controller controller1 -Credential (Get-Credential)
  • ONTAP

    PS> Add-NcCredential -Controller cluster1 -Credential (Get-Credential)

More help on Add-NaCredential, Get-NaCredential and Remove-NaCredential (or the equivalent Add-NcCredential, Get-NcCredential and Remove-NcCredential for ONTAP) can be found within the help files for the NetApp.ONTAP module.