A standard part of my server build I do everywhere is installing WireShark. WireShark of course requires WinPcap. While you can install WireShark silently, it conveniently doesn’t install WinPcap, rendering it useless. I used to work around this by installing NMap as part of the build since NMap does include WinPcap in its’ silent install. Unfortunately this seems to have broken under Windows Server 2008 R2.

The good news is you can work around this with the hackish but effective AutoIt. Below is my AutoIt script for installing WinPcap 4.1.1.

; ==========================================================================
; NAME: WinPcap AutoIt Installer
; AUTHOR: Brian Desmond, brian@briandesmond.com
; DATE  : 11/28/2009
; ==========================================================================

WinWaitActive("WinPcap 4.1.1 Setup")
WinWaitActive("WinPcap 4.1.1 Setup", "Welcome to the WinPcap")
WinWaitActive("WinPcap 4.1.1 Setup", "License Agreement")
WinWaitActive("WinPcap 4.1.1 Setup", "Installation options")
ControlClick("WinPcap 4.1.1 Setup", "Installation options", "[CLASS:Button; INSTANCE:2]") ; hack to click the install button
WinWaitActive("WinPcap 4.1.1 Setup", "Completing the WinPcap")
Note: This depends on the version number strings in the WinPcap setup. If it changes, you’ll need to tweak the script above accordingly.

I just compiled this to an EXE using the AutoIt compiler and it worked just fine.