Automate Lun Serial change after head swap or nvram change using Powershell Toolkit

by on ‎2012-09-18 10:56 PM - edited on ‎2014-09-25 03:18 PM by allison Former NetApp Employee
This is a powershell script which automates the process of reverting a filers lun serial numbers after a head upgrade or a NVRAM change. Requires Data ONTAP Powershell Toolkit.

 

After the files are generated, put the files somewhere in the filers /etc directory and use the DataONTAP "source" command to call them when it's time.

 

Based on Romeo Theriault's .pl script: https://communities.netapp.com/docs/DOC-2369

Which was based on Karel Verhelst's .vbs script: https://communities.netapp.com/docs/DOC-1754

 

Run this script ahead of time against the filers you will be upgrading.

 

For each filer you run it against it will create three files:

 

   filername_lunoffline

   filername_lunserial

   filername_lunonline

 

It will output these files in same directory as the script is executed.

It will check if these files exist before creating new ones and will delete them if they do exist.

 

Place these three files somewhere in the /etc directory of the root vol of the filer and after the head upgrade, use the filers source command to run the files.

 

   Example:

   source /etc/scripts/filername_lunoffline

   source /etc/scripts/filername_lunserial

   source /etc/scripts/filername_lunonline

 

Version 2 - Uses the .NET AppendAllText method of the System.IO.File class to produce output files with "LF" (Unix-type) Line Feed line breaks. (Instead of CR + LF (Windows-type) Carriage Return + Line Feed breaks.)

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.