OCSetup to add/remove roles/features on vista above

Ocsetup.exe tool functionality
The Ocsetup.exe tool provides functionality that resembles the functionality that the Sysocmgr.exe tool provides in Microsoft Windows XP and in Microsoft Windows Server 2003. In Windows Vista, Windows Defender Software Explorer and Windows Update use the Ocsetup.exe tool. In Windows Server 2008, Server Manager uses the Ocsetup.exe tool.

The Ocsetup.exe tool is used as a wrapper for Package Manager (Pkgmgr.exe) and for Windows Installer (Msiexec.exe). Ocsetup.exe is a command-line utility that can be used to perform scripted installs and scripted uninstalls of Windows optional components. The Ocsetup.exe tool replaces the Sysocmgr.exe tool that Windows XP and Windows Server 2003i use.

Windows optional components can be MSI-based or component-based. The Ocsetup.exe tool detects the type of optional component that is passed as a parameter. Additionally, the Ocsetup.exe tool calls the correct child process to install or to remove the optional component. If the optional component is MSI-based, the Ocsetup.exe tool calls Msiexec.exe. If the optional component is component-based, the Ocsetup.exe tool calls Pkgmgr.exe. The Ocsetup.exe tool returns back to the caller the exit code that is received from Pkgmgr.exe, from Msiexec.exe, or from the custom bootstrapping application.

For system optional components that are MSI-based, the Ocsetup.exe tool first checks a registry location to determine one of the following:
  • If a component uses the generic bootstrapping application (Ocsetup.exe).
  • If a component has a special custom-made bootstrapping application that performs install tasks or removal tasks.
Based on this determination, the Ocsetup.exe tool passes the task to the custom bootstrapping application, or the Ocsetup.exe tool internally performs generic bootstrapping tasks. The Ocsetup.exe tool performs the following generic tasks:
  • Checks the cache directory for updates.
  • Passes the MSI package name and the MSI package location to Windows Installer.
  • Passes names of one or more .msp files to Windows Installer.

The Ocsetup.exe tool also accepts configuration information that is supplied as an unattended file. For more information, see the unattended documentation.

 

Use Ocsetup.exe to install Windows optional components
  1. Click Start,right-click Command Prompt, and then click Run as administrator.
  2. At the command prompt, type the following command, and then press ENTER:
    start /w ocsetup Optional component name
    Notes
    • In step 2, Optional component name specifies the name of the Windows optional component. The optional component name is case sensitive. For example, if you want to install the DHCP Server role, type start /w ocsetup DHCPServerCore, and then press ENTER.
    • To determine the correct optional component name for Windows Vista to use with the ocsetup command-line, visit the following Web page, and then review the "Command-Line Name" column in the Microsoft-Windows-Foundation-Package Features table:
      http://technet2.microsoft.com/WindowsVista/en/library/92870ee6-516b-45f7-9f2a-9ac6772a120f1033.mspx?mfr=true (http://technet2.microsoft.com/WindowsVista/en/library/92870ee6-516b-45f7-9f2a-9ac6772a120f1033.mspx?mfr=true)
  3. Type exit, and then press ENTER to close the Command Prompt window.
Note To display the list of command-line switches that the Ocsetup.exe tool supports, type ocsetup at the command prompt, and then press ENTER.
Use Ocsetup.exe to remove Windows optional components
  1. Click Start , right-click Command Prompt, and then click Run as administrator.
  2. At the command prompt, type the following command, and then press ENTER:
    start /w ocsetup Optional component name /uninstall
    Notes
    • In step 2, Optional component name specifies the name of the Windows optional component. The optional component name is case sensitive. For example, if you want to remove the DHCP Server role, type start /w ocsetup DHCPServerCore /uninstall, and then press ENTER.
    • To determine the name of the Windows optional component, click Start
      Collapse this image Expand this image
      the Start button
      , type optionalfeatures in the Start Search box, and then click optionalfeatures in the Programs list.
  3. Type exit, and then press ENTER to close the Command Prompt window.

 Samples:

To install .Net Framework integrated in the OS:

start /wait ocsetup NetFx3

To install IIS roles,

start /wait ocsetup  IIS-WebServerRole

 

 

转载于:https://www.cnblogs.com/ColorAda/archive/2009/12/17/1626120.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值