Answered by:
Powershell, Netsh or .NET details to enable BranchCache on 2008 R2 Shares

Question
-
Hi all,
I need to enable BranchCache on about 2000 shares, is there a way to do it using powershell, Netsh or .NET so I can script it ?
Thanks,
Adam
Thursday, September 5, 2013 11:19 AM
Answers
-
Hi Adam -
I've received the following suggestions:
"I think that you could use Set-SmbShare –CachingMode BranchCache to do what you’re looking for.
In terms of the script to do this for two thousand shares… that’s another challenge.
The documentation is currently somewhat incorrect: http://technet.microsoft.com/en-us/library/jj635727.aspx
It states that it doesn’t take any input objects, but I’m pretty sure that you can pipe in a list of shares.
So… this should work to set BranchCache on all shares on the local system.Get-SmbShare | Set-SmbShare –CachingMode BranchCache
You could tweak the Get-SmbShare part to filter out the shares you want."
Hope that helps, thanks -
James McIllece
- Marked as answer by Adam Cooperman Saturday, September 7, 2013 1:33 PM
Friday, September 6, 2013 8:12 PM
All replies
-
I'm not certain whether you can do this, but the following references may be of assistance in determining whether it's possible:
BranchCache Cmdlets in Windows PowerShell
http://technet.microsoft.com/library/hh848392.aspx
SMB Share Cmdlets in Windows PowerShell
http://technet.microsoft.com/en-us/library/jj635726.aspx
Thanks -
James McIllece
Thursday, September 5, 2013 10:44 PM -
I have previously seen both of these documents, I could not find any suitable commands for enabling BranchCache.
I also cannot see anywhere within the win32_Share namespace that would be useful.Any other ideas or hints would be greatly appreciated.
Adam
Friday, September 6, 2013 7:34 AM -
I'm investigating this and will follow up if I find anything out for you.
Thanks -
James McIllece
Friday, September 6, 2013 6:50 PM -
Hi Adam -
I've received the following suggestions:
"I think that you could use Set-SmbShare –CachingMode BranchCache to do what you’re looking for.
In terms of the script to do this for two thousand shares… that’s another challenge.
The documentation is currently somewhat incorrect: http://technet.microsoft.com/en-us/library/jj635727.aspx
It states that it doesn’t take any input objects, but I’m pretty sure that you can pipe in a list of shares.
So… this should work to set BranchCache on all shares on the local system.Get-SmbShare | Set-SmbShare –CachingMode BranchCache
You could tweak the Get-SmbShare part to filter out the shares you want."
Hope that helps, thanks -
James McIllece
- Marked as answer by Adam Cooperman Saturday, September 7, 2013 1:33 PM
Friday, September 6, 2013 8:12 PM -
All I needed was the -CachingMode BranchCache :) Thanks a bunch.Saturday, September 7, 2013 1:33 PM