Windows Server 2008/2008 R2 的 ocsetup.exe 可以用來安裝或移除角色、角色服務、功能。由於這個程式的參數有大小寫之分,因此要使用時,要特別注意。
安裝的語法如下:
start /wait ocsetup <套件名稱>
移除的語法如下:
start /wait ocsetup <套件名稱> /uninstall
start 是用目前的是窗來執行 ocsetup.exe,而 /wait 參數是要等待 ocsetup.exe 執行完畢,才再出現 > 的符號。
把相關的套件名稱整理了一下,在 : 之後的是套件名稱:
Active Directory Domain Services (AD DS): DirectoryServices-Domain-Controller-ServerFoundation
Active Directory Lightweight Directory Services (AD LDS): DirectoryServices-ADAMServerCore
Backup: WindowsServerBackup
BitLocker Drive Encryption: BitLocker
BitLocker Drive Encryption Remote Administration Tool: BitLocker-RemoteAdminTool
DHCP Server: DHCPServerCore
DNS Server: DNS-Server-Core-Role
Failover Clustering: FailoverCluster-Core
File Services / DFS Namespaces: DFSN-Server
File Services / DFS Replication: DFSR-Infrastructure-ServerEdition
File Services / Services for Network File System: ServerForNFS-Base
File Services / File Replication Service: FRS-Infrastructure
Hyper-V (virtualization): Microsoft-Hyper-V
Multipath IO: MultipathIo
Network Load Balancing: NetworkLoadBalancingHeadlessServer
Print Services / Print Server: Printing-ServerCore-Role
Print Services / LPD Service: Printing-LPDPrintService
Quality Windows Audio Visual Experience: QWAVE
Removable Storage: Microsoft-Windows-RemovableStorage-ManagementCore
SNMP: SNMP-SC
Streaming Media Services: MediaServer
SUA: SUACore
Telnet client: TelnetClient
Web Server (IIS): IIS-WebServerRole
WINS: WINS-SC