Scripting with Failover Clustering File Share Scopes
Published Mar 15 2019 02:05 PM 1,052 Views
Microsoft
First published on MSDN on Jul 08, 2010

Hi Cluster Fans,


We have recieved many questions around the difference in behavior between Windows Server 2003 MSCS and Windows Server 2008 (and R2) Failover Clustering as it relates to the file shares and the new scoping behavior.  Chuck Timon’s article will help you understand the differences and the change in behavior: http://blogs.technet.com/askcore/archive/2009/01/09/file-share-scoping-in-windows-server-2008-f... .



With that cleared up, I’ve seen a few requests to get the old behavior and to share folders on multiple scopes.  You can do that by adding multiple client access points (CAP) to your highly available File Server.  This blog post illustrates how this can be achieved.



I’m starting with a HA File Server ahmedbc4FSy1 as you see here in this snapshot from Failover Cluster Manager.  Note that I’ve already populated those with some file shares.





To add a new scope, I can easily add a CAP to the same group from the Actions pane:





The name I’ll use is ahmedbc4FSnew.  Once done, I see multiple CAPs in the cluster group.





When I browse to \\ahmedbc4FSnew , I do not see the same shares I see when I browse to \\ahmedbc4FSy1 .  Why?  Check out the file share scoping information that is described in the linked article.



If you do want to share the same shares in that new scope, you can easily do that in the GUI by selecting the appropriate scope name when you “Add a shared folder”:





Once you run through the “Provision a Shared Folder Wizard (ahmedbc4FSnew)” wizard, you’ll have the share you in that new scope:





If you have a handful of shares to share in the new scope, you can easily do that through the GUI.  But, if you have many shares and you’d like to script this action, here is how it can be done.



What you’ll need before you run the script?


-          Run this in PowerShell v2.  You’ll need v2 because I use the new and (may I add) very powerful PowerShell CMDlet Add-Type.  If you have Windows Server 2008 R2, you have this in-box already.


-          Make sure you have the FailoverClusters PowerShell module installed.  If you are running this on a Windows Server 2008 R2 Failover Cluster node, you already have this in-box.


-          Run this in an elevated window.  If you start the PowerShell window using the “Windows PowerShell Modules” shortcut, that takes care of this.



The script is available here: http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/CommunityServer-Blogs-Components-WeblogFile...


Copy the contents of the script into file and rename it to share.ps1, change the $cluster, $from, and $to variables on the top of the script, and run the script to create the shares in the new scope.


Note that the new shares created with this script are read-only permission to everyone.  To update the permissions, you can update the script to set the proper permissions.  This can be done via WMI or command line tools.





For more information about using multiple client access points, as visit this blog: http://blogs.technet.com/b/askcore/archive/2010/08/24/using-multiple-client-access-points-cap-i... .


Enjoy!


Ahmed Bisht
Senior Program Manager
Clustering & High-Availability
Microsoft

Version history
Last update:
‎Mar 15 2019 02:05 PM
Updated by: