Netsh Commands

dump

Syntax: dump

Remarks: Creates a script that contains the current configuration. If saved to a file, this script can be used to restore altered configuration settings. The dump function is not implemented for the BranchCache context, and it cannot be used to generate a script to restore BranchCache configuration settings.

Example: dump

exportkey

Syntax: exportkey [outputfile=]<File Path> [passphrase]=<Pass Phrase>

Parameter Description

outputfile

The directory path and name of the file to which the key should be exported

passphrase

A passphrase required in order to import the key

Remarks: Exports the key that BranchCache uses to encrypt content. The key can then be imported on another computer by using the importkey command.

Examples:

exportkey %TMP%\secret.key "Key file password"

exportkey outputfile=C:\KeyDirectory\secret.key "Key file password"

flush

Syntax: flush

Remarks: Flushes the contents of the local cache.

importkey

Syntax: importkey [inputfile=]<File Path> [passphrase]=<Pass Phrase>

Parameter Description

inputfile

The location of the file from which the key should be imported

passphrase

The passphrase used when exporting the key using the exportkey command

Remarks: Imports a new key for the BranchCache service to use to protect content information. The key must have been previously exported by means of the exportkey command. If the service is currently running, this command will stop and restart it in order to begin using the new key.

Examples:

importkey %TMP%\secret.key "Key file password"

importkey inputfile=C:\KeyDirectory\secret.key "Key file password"

reset

Syntax: reset

Remarks: Resets the BranchCache service. Flushes the local cache. Every configuration parameter of BranchCache will be reset to its default value.

set mode

Syntax: set mode [ mode= ] { online | offline }

Parameter Description

mode

One of the following values:

online: Commit changes immediately

offline: Delay commit until explicitly requested

Remarks: Sets the current mode to online or offline.

set cachesize

Syntax: set cachesize [size=]{DEFAULT|<number>} [[percent=]{TRUE|FALSE}]

Parameter Description

size

The size of the cache. Set to DEFAULT to restore the default configuration.

percent

Determines if the size tag is treated as a percentage of the size of the hard disk or as an exact number of bytes. Ignored if the size tag is set to DEFAULT.

TRUE: size is a percentage of the size of the hard disk

FALSE: size is an exact number of bytes (Default)

Remarks: Sets the size of the BranchCache service's local cache. The size can be entered as either an exact number of bytes, or as a percentage of the size of the disk partition. Note that this refers to the size of the disk on which the cache is located, not the total size of all disks present on this computer.

Examples:

set cachesize DEFAULT

set cachesize 20971520

set cachesize size=20 percent=TRUE

set key

Syntax: set key [[passphrase=]<Pass Phrase>]

Parameter Description

passphrase

A passphrase to use to generate the key. If a passphrase is not provided, a random key will be generated. Two keys generated using the same passphrase will always be identical. Using a passphrase is a convenient way to duplicate the same key on another computer. (Optional)

Remarks: Generates a new key for the BranchCache service to use to protect content information. If the service is currently running, this command will stop and restart it in order to begin using the new key.

Examples:

set key

set key passphrase="I want my content to be secure"

set localcache

Syntax: set localcache [directory=]{DEFAULT|<File Path>}

Parameter Description

directory

The fully qualified path to the directory in which the local cache should be stored. Set to DEFAULT to restore the default cache location.

Remarks: Sets the location of the BranchCache service's local cache. Note that the service will be stopped and restarted if necessary to complete the change. Existing cache files will be moved to the new location. That location must reside on the local computer. If the new location is on a different volume, the new volume must have enough free space to accommodate the entire current cache file. Check the size of the current cache file before moving it to a new volume.

The cache file can be moved to a temporary device. If that device is removed, BranchCache will no longer cache and serve the data.

Examples:

set localcache DEFAULT

set localcache directory=C:\Branchcache\Localcache

set service

Syntax: set service

Parameter Description

mode

Set the status of the BranchCache Service

DISABLED - Disable the service

LOCAL - Uses Local Caching Only

DISTRIBUTED - Distributed Cache Enabled

HOSTEDSERVER - Set as a Hosted Cache Server

HOSTEDCLIENT- Set as a Hosted Cache Client

location

Set the location of the Hosted Cache Server. This tag is only necessary if the mode tag is set to HOSTEDCLIENT and is invalid otherwise.

clientauthentication

Set the mechanism used by a Hosted Cache Server to authenticate clients. This tag is only used if the mode tag is set to HOSTEDSERVER and is invalid otherwise.

Remarks: Sets the status of the BranchCache service. This command will also ensure that the necessary firewall configuration for the chosen modeis in place. It is strongly recommended that you provide a fully qualified domain name as the location of the Hosted Cache when setting Hosted Cache Client mode.

Examples:

set service DISABLED

set service mode=DISTRIBUTED

set service mode=HOSTEDCLIENT location=SERVER123

set service mode=HOSTEDSERVER clientauthentication=DOMAIN

show hostedcache

Syntax: show hostedcache

Remarks: Displays the location of the Hosted Cache

show localcache

Syntax: show localcache

Remarks: Displays the status of the local cache.

show status

Syntax: show status [[detail=]{BASIC|ALL}]

Parameter Description

detail

The level of detail to display (Optional)

BASIC: Display only basic information (Default)

ALL: Display all available information

Remarks: Displays the current status of the BranchCache Service.

Examples:

show status

show status ALL

show status detail=ALL