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!”
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s