Disabling Sound During Sysprep

In a business environment, you usually do not want users having the ability to produce sound on a computer. In the latest Dell GX280, GX620 and GX520s, however, they use the regular internal speaker as if it was a regular speaker. I actually remember doing this in Windows 3.1 with a special driver. The only problem is that when Windows 3.1 would play the sound nothing else would happen. If I was playing a game, Windows 3.1 will literally stop everything, play the sound and then resume operation of the computer.

Now, it’s easy enough to go into the device manager to disable the sound card after ghosting an image down to a machine. Wouldn’t it be better if we could script it? Well, we can! Microsoft has a niffy utility called devcon that will interact with the device manager on a command line level.

Every device in a computer will have an unique hexadecimal id. Download devcon and then issue “devcon find *”. This will return all of the devices in the system and there corresponding ids. Upon issuing this on a Dell GX620 and scrolling through the list we find this:

PCIVEN_8086&DEV_27DE&SUBSYS_01AD1028&REV_01: SoundMAX Integrated Digital Audio

Here’s the part we need:


Now we can type the following: “devcon disable “PCIVEN_8086&DEV_27DE”. Viola, the sound card is disabled! We can put this in the [GuiRunOnce] section in sysprep.inf to disable the sound. Repeat this for every model of computer you have (the statement for the GX280 looks like this: “devcon disable “PCIVEN_8086&DEV_266E””)

Wait….what about laptops? We give laptops to traveling users and it’s OK for for them to have sound. The problem with the above statement is that the Dell Latitude D610 and Dell Optiplex GX280 share the same sound chipset! The above statement will disable the sound chipset on both models. How can we get around this? Well, from a little trick from my sysprep page:

@echo off

C:installtemppci32 > C:installtempdev.txt

C:windowssystem32find /i “cardbus” C:installtempdev.txt >NUL

if errorlevel 1 “C:installtempsound.cmd”

if not errorlevel 1 echo “Not a workstation, do nothing”

Here’s what this does: it runs PCI32 from Craig Hart to run a hardware profile of our system and dumps the results into a file called dev.txt. It looks for any text with the labeling “Cardbus” in the dev.txt file. Cardbus is only found in laptops. If we find the term “cardbus”, the find program will return 0 and 1 if it doesn’t find it. Based on this result, we can determine whether we are imaging a laptop or desktop. If it’s a laptop, the command for disabling the sound never executes.

-Soli Deo Gloria

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.