Project Description
Farm diff tool helps the farm administrator to check the consistency between all the farm servers by comparing the following items
• GAC’ed assemblies
• MOSS 12 hive folder contents/File System
• OS level hot-fixes and patched installed on the servers

1. Problem Statement
In a large farm where day to day installation/uninstallation of products/custom components takes place, some installation/uninstallation can fail due to unknown reasons. This causes improper registration/removal of the .dll thus causing the servers in farm to go out of sync.
Another scenario is with the installation/removal of WSP packages in the Moss farm. A custom developed WSP package might get custom components (.Net Assemblies) and other files into the farm servers. A buggy WSP package too might to take the farm out of sync.
It a huge manual effort to get the list of GAC’ed Assemblies from each server machine in a farm and also the list of files on each of these server and compare the difference. The Farm diff Tool comes handy under these circumstances and easy the human effort to get an html report containing the difference between two machines.
2. ABSTRACT
Farm diff tool helps the farm administrator to verify the farm synchronization status by comparing the existence of the GAC’ed assemblies, installed software and files on the two or more server machines in the farm. Farm diff tool performs two tasks:
1) Gather: This component (PowerShell script file) gathers the data (GAC’ed assemblies, Software install and file details at a specified location) from the list of servers and places them into different files. This Gather script invokes a .NET class, which internally uses WMI to retrieve GAC’ed Assembly information and installed software information.
2) Comparer: This component (PowerShell script file again) takes the list of files generated by the gatherer as input and generates the HTML report pointing out the differences between two machines.
3. FEATURES
  1. Can be used to compare the GAC’ed Assemblies, installed software and files on the file system
  2. PowerShell scripts are used can be scheduled to run as scheduled jobs in a farm
  3. PowerShell scripts can be easily edit with basic knowledge on PowerShell, as most of the logic is abstracted in the .NET Assembly dll
  4. Both the Data Gather and Data Comparer are Configurable though easy editing of XML files
  5. Portable on PowerShell V1.0 and more
  6. Both the components have no dependencies and can be individually
  7. Data Gather component generates output in readable xml format and hence can be used be other custom developed tools
4. How to Use
Installation:
Pre-requisites/Dependencies:
  • .NET 3.5 or higher
  • PowerShell V1.0 or higher (to run Farm Diff Scripts)
  • WMI host service should be running on the farm machines
  • Gacutil & installutil tools needs to present on every machine of the farm to install and deploy .NET assembly
Installation Steps:
The installation has two parts: Installation of WMI provider for GAC’ed Assembly and setup of the Script files that are used to pull and compare the data.
Copy the install.zip file on the machine and extract the contents. Then you will find two folders: WMIGacProviderInstall and FarmDiffScripts
Installing the WMI GAC Assembly Provider

The WMI provider for GAC Assemblies must be installed on each server machine in a farm to retrieve the GAC’ed Assembly information
• Copy the WMIGacProviderInstall into each server on the farm
• Ensure WMI host service is running (By default this should be running)
• Run below commands to install / execute install-wmiGacProvider.bat file
gacutil -i GACAssemblyManifestReader.dll
installutil -i GACAssemblyManifestReader.dll

Note: The able command work if gacutil & installutil tools location is added to the Windows environment PATH variable.
Installing the Farm Diff PowerShell Scripts

The farm diff PowerShell scripts can be located at one location and can executed to gather and compare the data.
• Copy the folder “FarmDiffScripts” folder to server machine that has PowerShell installed

Usage:
Data Gatherer:
• Open the DataGatherer.Config file in text editor and replace the below element values
o FileSaveLocation: Location where the data files would be saved to
o ServerName: Add name of the server from which data needs to be retrieved
• Open PowerShell window
• Navigate the folder location containing the Scripts and execute DataGatherer.ps1 file in PowerShell window.

Comparer:
• Open the Comparator_Config.xml file in text editor and replace the below element values
o sourceServer: Name of the server whose data is considered as base data
o destinationServer: Name of the server whose data is compared to the base data to identify conflicts
o source: Data file full name with location that is considered as base data
o destination: Data file full name with location that is under focus for comparing
o parameter: xml attribute in the data files that is considered during comparing
• Open PowerShell window
• Navigate the folder location containing the Scripts and execute Comparator.ps1 file in PowerShell window.

Last edited Aug 30, 2010 at 2:55 PM by khadeerp, version 2