Deploy BranchCache Hosted Cache and Content Servers Using Windows PowerShell

If you're planning on deploying BranchCache in Hosted Cache Mode, you can use this post as a quick start guide to get your Content Servers and Hosted Cache Servers up and running quickly. To use these Windows PowerShell commands, you must have servers that are running Windows Server 2012 R2 or Windows Server 2012.

Note: If you're running Windows Server 2008 R2, you can download the BranchCache Deployment Guide for Windows Server 2008 R2 and Windows 7

CONFIGURE FILE SERVERS

You can deploy BranchCache file server-based content servers on computers running Windows Server 2012 R2 or Windows Server 2012 and the File Services server role. When you install the File Services server role, you must also install the BranchCache for network files role service.

When you deploy content servers that are file servers, you have the option to enable data deduplication. To gain an understanding of data deduplication before running the commands in this topic, see Data Deduplication Overview.

To install a BranchCache content server on a computer that does not already have File Services installed, type the following commands at the Windows PowerShell prompt, and then press ENTER.

Install-WindowsFeature FS-BranchCache -IncludeManagementTools
Restart-Computer

To install the Data Deduplication role service, type the following command, and then press ENTER.

Install-WindowsFeature FS-Data-Deduplication -IncludeManagementTools

To install a BranchCache content server on a computer that is already configured with the File Services server role, type the following commands at the Windows PowerShell prompt, and then press ENTER.

Install-WindowsFeature FS-BranchCache -IncludeManagementTools

To install the Data Deduplication role service, type the following command, and then press ENTER.

Install-WindowsFeature FS-Data-Deduplication -IncludeManagementTools

CONFIGURE OTHER TYPES OF CONTENT SERVERS

You can use this Windows PowerShell command to install the BranchCache feature and start the BranchCache service on a computer running Windows Server 2012 R2 or Windows Server 2012.

Install-WindowsFeature BranchCache
Restart-Computer

Note regarding Windows Server Update Services (WSUS) Content Servers:

After installing the BranchCache feature and starting the BranchCache service, WSUS servers must be configured to store update files on the local computer. When you configure WSUS servers to store update files on the local computer, both the update metadata and the update files are downloaded by and stored directly upon the WSUS server. This ensures that BranchCache client computers receive Microsoft product update files from the WSUS server rather than directly from the Microsoft Update Web site. To learn more about WSUS server configuration, see Advanced Synchronization Options for WSUS.

CONFIGURE HOSTED CACHE SERVERS

Note: You don't need to perform this step if you're using BranchCache Distributed Cache Mode, which does not require a server in each branch office. For information on BranchCache modes, see Choosing a BranchCache Design.

On the computer that you want to configure as a hosted cache server, run the following command at a Windows PowerShell prompt to install the BranchCache feature.

Install-WindowsFeature BranchCache -IncludeManagementTools

Configure the computer as a hosted cache server by using one of the following commands:

 - To configure a non-domain joined computer as a hosted cache server, type the following command at the Windows PowerShell prompt, and then press ENTER.

Enable-BCHostedServer

- To configure a domain joined computer as a hosted cache server, and to register a service connection point in Active Directory for automatic hosted cache server discovery by client computers, type the following command at the Windows PowerShell prompt, and then press ENTER.

Enable-BCHostedServer -RegisterSCP

To verify the correct configuration of the hosted cache server, type the following command at the Windows PowerShell prompt, and then press ENTER.

Get-BCStatus

After you run this command, in the output section HostedCacheServerConfiguration, the value for HostedCacheServerIsEnabled is True. If you configured a domain joined hosted cache server to register a service connection point (SCP) in Active Directory, the value for HostedCacheScpRegistrationEnabled is True.

You can optionally prepopulate the hosted cache server with content. For more information, see Prehashing and Preloading Content on Hosted Cache Servers (Optional).

Finally you need to configure client computers - either by using Group Policy (for domain-joined computers) or Windows PowerShell (for non-domain member computers). For instructions on how to configure your clients, see the topic Configure BranchCache Client Computers.