Remote Installation of the Windows Components


Add/Remove Programs is the best place to install some of the optional Windows components, such as SNMP support. However, what if this component has to be installed on many servers? Microsoft provides the SYSOCMGR.exe utility to do that from the command line.

Therefore, any component can be installed remotely (with use of PSEXEC) and quietly. The article How to add or remove Windows Components by using Sysocmgr.exe (http://support.microsoft.com/?kbid=222444) describes the main idea, but does not give the comprehensive information. Below there is a way how to do that from the beginning to the end.

Let’s assume that we need to install SNMP service on a remote computer. The steps to do that will be as follow:

  • Create an unattended file
  • Set up the location of Windows installation files and Windows Service Pack files
  • Run SYSOCMGR.exe remotely and silently
  • Clean up the leftovers of the installation

Create an unattended file

As Microsoft says, SYSOCMGR.exe parses only two sections of the unattended file: [Components] and [NetOptionalComponents]. In order to find what to write into these sections, you need to take a look into the unattended.txt file (in \SUPPORT\TOOLS\deploy.cab on the installation CD). Also the list of [NetOptionalComponents] is available here: http://technet.microsoft.com/en-us/library/cc755697%28WS.10%29.aspx

This is the table from that list:

Entry Description
Beacon Specifies whether to install the beacon client.
DHCPServer Specifies whether to install the DHCP Server service and configure the computer as a DHCP server.
DNS Specifies whether to install DNS Server service and configure the computer as a DNS server.
IAS Specifies whether to install the Internet Authentication Services (IAS) and creates a shortcut to the IAS MMC snap-in under Administrative Tools on the Start menu.
ILS Specifies whether to install the Internet Location Service (ILS).
LPDSVC Specifies whether to install Print Services for UNIX.
MacPrint Specifies whether to install Print Server Services for Macintosh.
MacSrv Specifies whether to install Services for Macintosh.
NetCMAK Specifies whether to install the Microsoft Connection Manager Administration Kit.
NetCPS Specifies whether to install the Microsoft Connection Point Services.
NetMonTools Specifies whether to install Network Monitor Tools.
SimpTcp Specifies whether to install Simple TCP/IP Services.
SNMP Specifies whether to install Simple Network Management Protocol (SNMP).
WBEMSNMP Specifies whether to install the WMI SNMP Provider components.
WINS Specifies whether to install WINS.

Not all of the listed components are available on Windows 2000, so check out the link for more information.

The list of possible entries for [Components] section is the following:

Entry Description
Accessopt ??
Calc Calculator
Cdplayer CD player
Certsrv Certificate services
certsrv_client Certificate services client
certsrv_server Certificate services server
charmap Character map
chat Chat
cluster Cluster
deskpaper Desktop wallpapers
dialer
fp
freecell Freecell Game
hypertrm HyperTerminal
iis_common IIS Common files
iisdbg
iis_doc IIS Documentation
iis_ftp IIS FTP service
iis_htmla
iis_inetmgr
iis_nntp IIS NTTP service
iis_nntp_docs IIS NTTP service documentation
iis_pwmgr
iis_smtp IIS SMTP service
iis_smtp_docs IIS SMTP service documentation
iis_www IIS WWW service
indexsrv_system Indexing service
LicenseServer
media_clips
media_utopia
minesweeper The Minesweeper game
mousepoint Mouse pointers
mplay Media player
msmq Message Queuing
mswordpad WordPad
netcis
netoc
objectpkg
paint MS Paint
pinball The Pinball game
rec
reminst RIS (Deployment services)
rstorage
solitaire The Solitaire game
templates Document templates
TSClients
TSEnable Terminal Server
vol

In order to enable or disable components in the [Components] section use on (to install) or off (to uninstall). For the [NetOptionalComponents] section you use 1 (to install) or 0 (to uninstall).

For the SNMP service installation the unattended file will contain these four lines:

[Components]

NetOC=ON

[NetOptionalComponents]

SNMP=1

Let’s save this file as C:\TEMP\SNMP.txt

Set up the location of Windows installation files and Windows Service Pack files

During the installation of the Windows components the SYSOCMGR.exe utility needs an access to the installation files. In order to avoid the message requesting for the installation CD, we can provide the path to the installation files.

Two registry values are responsible for this information:

HKLM\SOFTWARE\Microsoft\Windows\Current Version\Setup\ SourcePath

and

HKLM\SOFTWARE\Microsoft\Windows\Current Version\Setup\ServicePackSourcePath

In the script we need to save the values, set them up with the proper locations and change them back after installation is complete.

Use of .REG file is the easiest way to apply these changes. This is the example of the Path.reg file

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]

“SourcePath”=”C:\\Software\\Windows XP SP3”

“ServicePackSourcePath”=”C:\\Software\\Windows XP SP3”

Note: Do not forget to use double backslashes

Note: The I386 folder will be added to the path automatically, so that do not include it

Run SYSOCMGR.exe silently

The SYSOCMGR.exe syntax is

sysocmgr[.exe] /i:InfFile.inf [/u:AnswerFilePathAndName [/q][/w]] [/r][/z][/n][/f][/c][/x] [/l]

Parameter Description
/i:InfFile.inf Required. Designates the InfFile.inf that you specify as the master .inf file.
/u:AnswerFilePathAndName Specifies the path and file name of an optional answer file that contains parameters for unattended installation.
/q Runs the unattended installation without a user interface. You cannot use /q without /u.
/w Prompts the user before rebooting, only if reboot is required. You cannot use /w without /u.
/r Suppresses reboot. If reboot is not necessary, this command-line option has no effect.
/z Indicates that the arguments that follow are not optional component arguments and they should be passed to the components.
/n Forces the master .inf to be treated as new.
/f Indicates that all component installation states should be initialized as if their installers had never been run.
/c Disallows cancellation during the final installation phase.
/x Suppresses the initializing banner.
/l Multi-language aware installation.
[/?] [/h] [IncorrectSyntax] Displays help in a separate window, not at the command prompt.

The command to install the SNMP service will now look like:

%windir%\system32\sysocmgr.exe /r /q /i:%windir%\inf\sysoc.inf /u:c:\TEMP\SNMP.txt

Automation

This script will do everything for you. This script should have PSEXEC.exe in its folder. The script asks for the folder name, which contains all the necessary files, copies all the files to C:\TEMP on the target server(s) and runs the batch file via PSEXEC.

NOTE: Well, as I have found, SYSOCMGR does not work via PSEXEC. I spent two days to find the reason and the solution. I still have no idea about the reason of such behaviour, but I have the solution. This is the SCHTASKS utility, which replaced AT.exe in Windows XP and Windows 2003. The updated script is here. You can find more information about SCHTASKS in this article

The batch file for this process can look like this:

REM Delete the previous copy of the saved reg file if any

del “c:\TEMP\SetupRegKey.reg” /q

REM Save the info from the registry

reg save “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup” “c:\TEMP\SetupRegKey.reg”

REM Merge the .REG file to change the installation source paths

reg import “c:\TEMP\Paths.reg”

REM Run the SNMP installation

“%windir%\system32\sysocmgr.exe” /r /i:”%windir%\inf\sysoc.inf” /u:”c:\TEMP\SNMP.txt”

REM Restore the installation source paths saved earlier

reg restore “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup” “c:\TEMP\SetupRegKey.reg”


Advertisements

18 Responses to Remote Installation of the Windows Components

  1. Bharatha Selvan says:

    Hi,

    I could understand the script, if i run this script on the client machine locally(logging in to the remote machine) it installs SNMP successfully, but how to run this script on the remote machine. I tried to create a new Win32_Process with this script on the remote machine, it gets executed but not installing SNMP.

    Your timely help will be much appreciated.

    Regards
    Bharatha Selvan.

    • That’s why I use PSEXEC. The script creates a command to run PSEXEC with parameters, which in its turn runs a batch file on a remote computer.

      So you have to have PSEXEC in a script directory in order to run the batch file remotely

      • Bharatha Selvan says:

        Hi,

        Thanks for the clarification.

        I couldn’t download the script from “This script” link in your blog, that’s why i formed a .bat script with above set of commands and tried executing it on the remote machine via WMI.

        Could you please send me your working script file so that i can try with psexec.exe in my environment.

        Regards
        Bharatha Selvan

  2. Bharatha Selvan says:

    Hi,

    I have tried with PsExec tool also with no success. Please suggest me some ways to debug sysocmgr tool, like will it log it’s operations/failure messages some where, so that we can check the logs and take corrective actions.

    It’s very urgent for me, your timely help will be much appreciated.

    Regards
    Bharatha Selvan.

  3. Are you using the sysocmgr from the correct OS edition?
    It requires the access to the installation CD, so that you need to make registry changes and point to the proper location of the installation files BEFORE running SYSOCMGR

    Hopefully it helps

  4. zadumov says:

    I would like to exchange links with your site winadminnotes.wordpress.com
    Is this possible?

  5. How would this work for a completely fresh install then? Could you boot it up from a USB device/drive?

  6. […] it does not.In this article I showed how to use SYSOCMGR to install Windows optional components remotely and silently. I tested […]

  7. jane says:

    All these issues are important, and that’s why I just started blogging a while ago and it feels great

  8. lg led tv reviews…

    […]Remote Installation of the Windows Components « Notes of Windows Admin[…]…

  9. HVAC says:

    HVAC…

    […]Remote Installation of the Windows Components « Notes of Windows Admin[…]…

  10. okna katowice, okna kielce, okna szczecin, okna sosnowiec, okna wejherowo, okna opole, rolety…

    […]Remote Installation of the Windows Components « Notes of Windows Admin[…]…

  11. solar system says:

    solar system…

    […]Remote Installation of the Windows Components « Notes of Windows Admin[…]…

  12. Greetings! Very useful advice within this article!
    It’s the little changes which will make the most important changes.
    Thanks for sharing!

  13. […] Remote Installation of the Windows Components | Notes of … – Jul 09, 2010 · The command to install the SNMP service will now look like: %windir%system32sysocmgr.exe /r /q /i:%windir%infsysoc.inf /u:c:TEMPSNMP.txt… […]

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

%d bloggers like this: