Reduce Your Windows 2008 Server Core Installation by ~200MB

In Windows Server 2008, Server Core installation does not include the traditional full graphical user interface (GUI). A Server Core installation provides a minimal environment for running specific server roles, which reduces the maintenance and management requirements and the attack surface for those server roles. A server running a Server Core installation supports the following server roles:

  • Active Directory Domain Services (AD DS)
  • Active Directory Lightweight Directory Services (AD LDS)
  • DHCP Server
  • DNS Server
  • File Services
  • Print Services
  • Streaming Media Services
  • Internet Information Services (IIS)
  • Windows Virtualization (Hyper-V)

Although Server Core is a lot smaller in size than a regular full-GUI Windows Server 2008 installation, the Server Core blog has recently written about an interesting way to further reduce this footprint by removing the server roles and optional features that you do not require from the disk. By doing so, you can free up more space. It is estimated that you will be able to free up as much as 200 MB of disk space if you remove all un-needed roles and features. This procedure could be used to prevent an administrator from adding a role or feature to a server that is supposed to perform a fixed function.

Warning: Removing a role or feature from the hard disk is irreversible. Once a role or feature is removed, the only option is to reinstall; there is no way to bring it back.
An even greater warning: Be very careful to comment out any line that has a role you’re currently running! If you run this script on a Windows Server 2008 machine that already has that specifc role installed, this will remove it completely and render the machine useless…

To remove roles or features from a Server Core installation please follow these steps:

1. Run the following command in the command prompt window:

pkgmgr /up:<package to remove>

2. Reboot the server.  Note that it is possible to remove multiple packages before having to reboot.
3. Wait approx 30 minutes for the disk cleanup. This is important.
You will then notice:

  • the disk space used by the role or feature is freed up
  • oclist doesn’t show the role or feature as being available
  • trying to install using ocsetup results in an error

The removeable role and feature packages are:
Note: If running on an x86 server, change amd64 below to x86. The names themselves are pretty self-descriptive, but are also CASE SENSITIVE!

  • Microsoft-Hyper-V-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-BLB-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DFSN-ServerCore~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DFSR-ServerEdition-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DhcpServerCore-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DirectoryServices-ADAM-SrvFnd-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DirectoryServices-DomainController-SrvFnd-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-DNS-Server-Core-Role-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-FailoverCluster-Core-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-FileReplication-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-IIS-WebServer-Core-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-Internet-Naming-Service-SC-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-MultipathIo-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-NetworkLoadBalancingHeadlessServer-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-NFS-ServerFoundation-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-Printing-ServerCore-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-QWAVE-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-RemovableStorageManagementCore-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-SecureStartup-OC-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-SNMP-SC-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-SUA-Core-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-Telnet-Client-Package~31bf3856ad364e35~amd64~~6.0.6001.18000

You can also remove fonts and IME support to further reduce the server’s footprint by removing the following packages: In order to do that, you need to remove the following packages:

  • Microsoft-Windows-ServerCore-EA-Fonts-Package~31bf3856ad364e35~amd64~~6.0.6001.18000
  • Microsoft-Windows-ServerCore-EA-IME-Package~31bf3856ad364e35~amd64~~6.0.6001.18000

Interesting stuff. Proceed with caution, and remember, never remove a role or feature that you actually need!
Related Links:
Server Core: