3

I know I can access the SharePoint-buildversion using (Get-SPFarm).buildversion in PowerShell.

I also know that by accessing /_admin/PatchStatus.aspx from central administration I can view each installed hotfix (among other things).

Is there a way to programatically check (via server object model or PowerShell) whether a given hotfix (i.e. http://support.microsoft.com/kb/2687339) is installed or not?

1

The information displayed on the Patch Status page uses a GridView control that is populated by the Microsoft.SharePoint.ApplicationPages.PatchStatusDataSourceView object in the Microsoft.SharePoint.ApplicationPages.Administration assembly (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\ADMINBIN\Microsoft.SharePoint.ApplicationPages.Administration.dll). This object is instantiated by the Microsoft.SharePoint.WebControls.AdministrationDataSourceControl object in Microsoft.SharePoint.dll.

You could use that same data source to get your data. For example:

var adminDataSourceControl = new AdministrationDataSourceControl() { ViewName = "PatchStatus" };
gridview.AutoGenerateColumns = true;
gridview.DataSource = adminDataSourceControl;
gridview.DataBind();

This does get the data, however the only caveat I found is that it needs to run under the Central Administration site. You could dig further to figure out what resources you need to make it load elsewhere.

  • John, thanks for the answer. However I was thinking more along the lines of farm.GetAllPatches() :-) Using the DataSource-Control seems to be part of the UI-Controls and I'm not sure whether they can be used in PowerShell or featureRecievers. – Nils Feb 15 '13 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.