If you're responsible for
administering a large number of
computers, you appreciate methods of automating common administrative
tasks. A need to add or remove individual system components might
result from a change in corporate policy, discovery of security
vulnerability, or simply a newly emerged business need. Using
sneakernet for such tasks might take considerable amount of time.
Fortunately, Microsoft provides a way to accomplish this task in an
unattended way. Windows 2000 and XP contain the
SYSOCMGR.EXE file in the
%systemroot%\system32 folder. When executed,
this command-line utility analyzes the content of two files:
sysoc.inf (the existing configuration file,
located in %systemroot%\inf folder) and a
specially formatted text file (which you can give an arbitrary name)
that contains a listing of components to be added or removed.
The sysoc.inf file is used by Windows when
running the Add/Remove Programs applet in the Control Panel.
It's format is typical of standard
.inf files: it is divided into several sections,
each starting with a name enclosed in square brackets. The
[Components] section consists of multiple lines,
one per component. Each line starts with the component name, followed
by references to .dll and .inf
files used during installation or uninstallation.
Hide entry determines whether
the component appears in Add/Remove Programs applet.
The second text file (which you need to create) can have an
arbitrarily chosen name; for example, c:\comp.txt
will do nicely. This file can be created using Notepad and
should contain the [Components] section, followed
by one or more lines of the following format:
Component_Name = On/Off
Here, On is used for installation and
Off is used for uninstallation. For example, to
remove Windows Messenger and add Faxing, the file should contain the
You can also install optional networking components by including the
line Netoc=On and the additional section
[NetOptionalComponents]. This section would
contain lines that refer to different networking components, such as
SimpTcp or wins, like so:
A value of 1 causes installation and
0 causes uninstallation. The names of the
components are the same as the ones used during unattended
installation of the operating system, which are documented in the
Unattended.doc file on the Windows installation
CD in the Support\Tools folder.
Running the Hack
Once you've created your Comp.txt
file, you can now use sysocmgr.exe in
unattended installation mode to add or remove Windows components.
Simply run the following command:
SYSOCMGR.EXE /i:%windir%\inf\sysoc.inf /u:c:\comp.txt
Note that this approach will not work with the COM+, Distributed
Transaction Coordinator, Microsoft Fax, and Windows Media Player
services, because these components are not removable.