Compartir a través de


OCSetup Command-Line Options

OCSetup is available as part of the Windows Vista® and Windows Server® 2008 operating system. This tool replaces Sysocmgr.exe, which is included in the Windows XP and Windows Server 2003 operating systems.

You can use OCSetup.exe on a computer running Windows Vista or Windows Server 2008 to install or uninstall:

  • Microsoft System Installer (MSI) files that are passed to the Windows Installer service (MSIExec.exe)
  • Component-Based Servicing (CBS) components that are passed to Package Manager
  • CBS or MSI packages that have an associated custom installer .exe file

To use OCSetup and Package Manager, the system MSIs must be staged before they are installed, and the paths to the packages must be specified in an answer file.

Before running OCSetup at a command prompt, set the command prompt to run as an administrator (even if you are logged on as an administrator on the computer).

  1. Click Start, point to All Programs, and then click Accessories.
  2. Right-click Command Prompt, and then click Run as administrator.

The following command-line options are available for OCSetup.

ocsetup.exe [/?] [/h] [/help] component [/log:file] [/norestart] [/passive] [/quiet] [/unattendfile:file] [/uninstall] [/x: parameter]

The following table shows the syntax for the OCSetup command-line options.

Parameter Description

/?, /h, /help

Displays help for all options when run with or without options.

component

The name of the component to be installed or uninstalled. The component name is case-sensitive.

/log:file

Specifies a non-default log file location.

/norestart

The computer is not rebooted even if required after component installation.

/passive

Unattended mode. Progress only.

/quiet

Quiet mode. No user interaction.

/unattendfile:file

The file contains overrides or additions to default configuration settings. Implies passive mode.

/uninstall

Uninstalls the component. Installation is default.

/x: parameter

Additional configuration parameters to be applied when installing a component that requires a custom installer. OCSetup will pass these parameters to the custom installer.

To determine if a component has a custom installer, review the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OptionalComponents\componentName

The value of CustomSetup is the name of the custom installer. If the CustomSetup value is supplied, OCSetup defers to the indicated EXE to perform the installation of the package. The EXE is expected to conform to the same command line specification as OCSetup.exe, and must return the same exit codes.

Note
This registry key will not exist in Windows Vista if system MSI files are not installed. In addition, this registry key will not exist if you have not registered the packages that require a custom installer and have not defined the custom installer.

If you are installing or uninstalling a package that requires a custom installer, you must register the name of the package. When you register the name of the package, you also identify the type of package (CBS or MSI), any updates that have been applied, and the name of the custom installer .exe file.

To register a package that requires a custom installer, edit the following registry key.

**HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OCSetup\Components\**ComponentName

Add the following values under this key:

Value Type Data

Type

REG_DWORD

Type of package

0 - CBS

1 - MSI

Component

REG_SZ

The name of the CBS update or the path to the MSI.

PatchFiles

REG_MULTI_SZ

(Optional) Path to the MSI update file.

CustomSetup

REG_SZ

(Optional) Path to the custom installer .exe file.

The custom installer is expected to conform to the same command line specification as OCSetup.exe, and must return the same exit codes.

If you are configuring Windows features without using an answer file that was created in Windows System Image Manager (Windows SIM), use the command-line name in the Windows-Foundation-Package section of the Unattended Windows Setup Reference. The name is case-sensitive.

Examples

The following table gives examples of using OCSetup to establish server roles that have no dependencies.

Server Role Command

Dynamic Host Configuration Protocol (DHCP) Server

start /w ocsetup DHCPServer

Domain Name System (DNS) Server

start /w ocsetup DNS-Server-Full-Role

Windows Deployment Services (Windows DS)

start /w ocsetup Microsoft-Windows-Deployment-Services

The following table gives examples of using OCSetup to enable Windows features available in server editions.

Windows Feature Command

Desktop Experience

start /w ocsetup DesktopExperience

Failover Clustering

start /w ocsetup FailoverCluster-FullServer

Windows Server Backup

start /w ocsetup WindowsServerBackup

Troubleshooting

To verify that a component is installed, do one of the following:

  • Verify in the Event Viewer that OCSetup raised the event OCSETUP_EVENT_INSTALLSUCCESS.
  • If you are enabling a Windows feature, in Control Panel, click Programs, under Programs and Features, click Turn Windows features on or off, and then confirm that the check box for the Windows feature is selected.

To verify that a component was removed, do one of the following:

  • Verify in the Event Viewer that OCSetup raised the event OCSETUP_EVENT_UNINSTALLSUCCESS.
  • If you are disabling a Windows feature, in Control Panel, click Programs, and then, under Programs and Features, click Turn Windows features on or off. Make sure the check box for the Windows feature is cleared.

Additional troubleshooting information can be found in the following log files:

  • Windows Update log (%WINDIR%\WindowsUpdate.log)
  • Component-Based Servicing Log (%WINDIR%\logs\cbs\cbs.log)

See Also

Concepts

Package Manager Technical Reference
How Package Manager Works