Sometimes I blog so I do not forget what I have learned and this would be one of those occasions. I recently ran into the issue that I had to get the version number of an environment to which I had no administrative access for support purposes. Normally I would pop over to site settings to get the farm version number and as such, I did not even have Administrative permissions on any site. Luckily, I knew that SharePoint broadcasts its version number with each request to the system as part of the page headers so all that is necessary is to create a script that reads the headers of a Web Request to SharePoint and Spit out the Header Variable MicrosoftSharePointTeamServices. Glad I only have to type that once! This works if you only have read only/basic/limited permissions to the site, or furthermore if you have requisite access and are looking for a remote version, this is for you.
#Url to the a SharePoint Site you have access to (Integrated Authentication), replace with the url in your environment
$url = "http://sharepoint/sites/team/_layouts/viewlists.aspx"
#Create the web request object which we're going to access
$request = [System.Net.HttpWebRequest]::Create($url)
#Specify that we want to use the default system credentials to access the site
$request.UseDefaultCredentials = $true
#Send the request to sharepoint and get the response in a new object
$result = $request.GetResponse()
#Access the Headers to get the SharePoint Version number
Please note however that this will not retrieve the cumulative update level, just the minor version level. So when you execute it you will see an output like this:
The part we care about looks like this: As you can see the build number returned is 18.104.22.16820 which you can then reference luckily on Todd Klindt’s Blog
Hope you find this useful!