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.
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" }
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 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'
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" }
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.