Extract List of Users From a NetApp Controller and Re-add them after a Maintenance

Recently we received a requirement from a customer for a task related to Storage Controller Maintenance activity running on Data-Ontap 7-Mode.

 

The requirement was to get a list of all users with their capabilities from a Netapp Storage Controller, perform a set of activities on it and readd them.

 

Here's a way on how we can use the Data ONTAP PowerShell Toolkit 2.2 to attain this functionality.

 

      1) Establish a connection to a Data ONTAP storage controller :- Use Connect-NaController cmdlet to establish a connection to the storage controller using HTTPS/HTTP. PowerShell will prompt for credentials.

 

  Connect-NaController 10.233.183.35 -Credential (Get-Credential)

 

 

 

      2)  Export User Information :- Extract list of all users in storage group along with group membership (capabilities) and export them to a csv file.

 

   Get-NaUser | select name,@{l='Group';e={Get-NaUser $_.name | select -ExpandProperty groups}} | Export-Csv "C:\Users\vinith\Desktop\user.csv" –NoTypeInformation

  

  

 

      3) Recreate User's on the Storage Controller :- Import the List of users again and re-add them to the controller with desired password.

 

   Import-Csv "C:\Users\vinith\Desktop\user.csv" | % { New-NaUser -User $_.name -Password "netapp1!" -Groups $_.group}

 

 

 

      4) Verify the Users are added :- Run a Get-NaUser and verify that the users show up with their group memberships.

 

   Get-NaUser | select name,@{l='Group';e={Get-NaUser $_.name | select -ExpandProperty groups}}