SharePoint – Retrive the internal column name for lists/libraries using PowerShell

I have been using this method for some time now and decided to make a slight change to it.  I have been using the PowerShell method found here to find the internal column names for my lists and libraries.  It works great.  The only problem with this is that I have to modify the script each time I need to change the value of the list or site.  This is usually not a big deal since I generally am only looking at one list.  This was not the case the other day.  I needed to look at many different lists in the same site.  Instead of having to modify the script each time, I added a set of parameters to prompt me at the command line.  The code looks like this:

  1. Download Get Column Names Script
  2. Save the script to a directory on your SharePoint server
  3. Open the SharePoint Management Shell for PowerShell
  4. Navigate to the directory where you downloaded the script
    example:  d:\scripts
  5. Run the script: getColumnName.ps1
  6. Enter in the variables
    ***To include hidden fields, change {$_Hidden -eq $false} to {$_Hidden -eq $true}***

Your screen should resemble the following before the command runs

psGetCN

Mike Smith has a lot of great tips on his site.  I suggest that you check it out:  http://techtrainingnotes.blogspot.com/

Stay Salty!

Leave a Reply