Whilst a simple script, this illustrates the real advantages of PowerShell. I needed to find the ID’s of some site columns I had created in SharePoint 2010. In the days of MOSS 2007, I would have had to either work out the GUID from looking at the URL of the column in the browser or write a custom application in Visual Studio to get the information I needed by accessing the Object Model. Now, I spend a minute writing a script in PowerShell and it’s reusable time and time again.
The script asks the user to input the display name of the site column and then gets the name and GUID of the column and outputs it to the console. I have configured the URL as a variable, but you could also ask the user for this if you wanted to:
$web = Get-SPWeb http://portal
$columnName = Read-Host "Enter the column title (display name)"
write-host $web.Fields[$columnName].Title -nonewline
write-host " "$web.Fields[$columnName].Id -foregroundcolor Red
You could use the essence of this script to find a whole bunch of information about the column, if required. A full list of properties can be found on MSDN here.