Comparing system DLL files between two systems

Posted: March 14, 2012 in File Operations, Scripts

Ever had one of those really odd issues where the prod and test server are supposed to be identical, but a process works on one and not the other? I had that recently and I was sure it was related to a service pack or application upgrade that had taken place. I ran this Powershell script across the 2 servers to find any DLLs in the System32 directory that were different. Turned out to be the MSJET35.dll.

This script uses the Powershell Community Extensions installed.

Import-Module PSCX

$WinDLLs = Get-ChildItem \\prodserver\c$\windows\system32\ *.dll

ForEach ($WinDLL in $WinDLLs){

$ProdHashString = (Get-Hash $WinDLL.FullName).HashString

$TestDLL = “\\testserver\c$\windows\system32\” + $WinDLL.Name

If (Test-Path $TestDll){
$TestHashString = (Get-Hash $TestDLL).HashString

If ($ProdHashString -ne $TestHashString){
Write-Host “File $TestDll is different!”
}
}
Else{
Write-Host “$TestDLL does not exist!”
}
}

Leave a comment