Network Administrator Knowledgebase

Oct 31 2008   12:53AM GMT

Install Windows Components from Command Line



Posted by: Michael Khanin
Tags:
Command line
Microsoft Windows

Windows XP and Windows Server 2000 / 2003 have a built-in utility called the System stand-alone Optional Component Manager (sysocmgr.exe) to programmatically add or remove Windows components. Running sysocmgr.exe with no parameters will display the usage. The most basic command line is:

%windir%\system32\sysocmgr.exe /i:%windir%\inf\sysoc.inf This parameter (/i:) is always required and specifies the location of the master inf (%windir%\inf\sysoc.inf). When run it simply displays the Windows Components Wizard. Therefore the above command can be used as a shortcut directly to the Windows Components Wizard.

The real power of sysocmgr is in unattended mode. Additional parameters control the user interface, handle restarting, and control which components are added or removed by way of a standard Windows unattended answer file. Sysocmgr only looks in the [Components] and [NetOptionalComponents] sections, so the answer file can be specifically for component management or reused from a Windows unattended installation. Some components have their own unattended answer file sections, which are also parsed.

The following example uses an answer file (/u:) named ocm.txt in the temporary directory (%temp%\ocm.txt), suppresses any necessary restart (/r), and displays no user interface (/q):

%windir%\system32\sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:%temp%\ocm.txt /r /q

The following example answer file adds the Simple Network Management Protocol (SNMP) service and configures the agent settings:

[NetOptionalComponents]
SNMP = 1

[SNMP]
Contact_Name = Michael Khanin
Location = Canada

Service = Physical, Applications, End-to-End

Community_Name = Public
Traps = server1.thesystemadministrator.com, server2.thesystemadministrator.com

Send_Authentication = Yes
Accept_CommunityName = Public:Read_Only
Any_Host = No
Limit_Host = server1.thesystemadministrator.com, server2.thesystemadministrator.com

Tips:

  • Sysocmgr can only be run by users with local administrative rights. It can be combined with runas, e.g.,

runas /user:admin “%windir%\system32\sysocmgr.exe /i:%windir%\inf\sysoc.inf”

  • Make sure that the target system has the Windows installation source available. The following registry values must point to a source to which the administrative user has access (e.g., if a network path, a local administrator account may not be able to access it):


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]
“SourcePath”=”c:\\windows\\i386″
“Installation Sources”= … (REG_MULTI_SZ value)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
“SourcePath”=”c:\\windows\\i386″

Source: TheSystemAdministrator.com

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: