Determine SharePoint Farm Version Remotely using PowerShell

Earlier this week, I wrote a post about how you can use PowerShell to determine what version of a SharePoint Farm and Updateable Components you are running in a given environment. I also wrote, a few months ago, a short article on using SharePoint’s service.cnf endpoint to remotely return the farm’s version of an environment. Today I decided to combine both articles and to demo how it is possible for one to write a short PowerShell script that will remotely ping the service.cnf service to remotely retrieve the farm’s version. The PowerShell script below will prompt the user for the URL of any site on the given Farm, and will automatically build the service’s url:

http://<url of given site>/_vti_bin/service.cnf

Then it will use the Invoke-WebRequest cmdlet to retrieve the content back from the web service using a Screen Scrapping methodology. It will then manipulate the content retrieved to extract only the Farm’s build number and print it on screen. Please note that this script will use the default user’s credentials to connect remotely to the environment. Here is the full script:

​$url = Read-Host “URL of Web Application”
if($url.EndsWith(“/”) -eq $false)
$url = $url + “/”;
$serviceUrl = $url + “_vti_pvt/service.cnf”
$response = Invoke-WebRequest $serviceUrl -UseDefaultCredentials
$content = $response.Content


Leave a Reply

Your email address will not be published. Required fields are marked *