I have File Service cluster where one of the file server resources is hosting ~50,000 user home directories. The home directories do have a quota template assigned through the FSRM.
When trying to add a new share using the Failover Cluster Manager's "Add File Share" wizard, it starts by retrieving all quotas on all shared folders over all defined file server cluster resources. Which is taking ~10 minutes in this environment.
How could I either
- speed up the process of quota enumeration
- limit the quota enumeration process to just a single file server cluster resource
- disable the quota enumeration completely for the New Share Wizard
?
I finally worked around the problem by lifting the requirement to use the GUI for file share creation entirely. Instead, I documented the use of New-SmbShare as the share creation procedure. Adding shares in this way bypasses all pre-configuration checks the GUI wizard is performing, including the quota enumeration.
The
New-SmbShare
cmdlet has been introduced with Server 2012 R2 / Windows 8.1. For previous (2012, 2008R2, 2008) version File Server clusters, you can borrow theNativeMethods
class with which is importing the NetShareAdd function from Netapi32.dll from a script published along with an MSDN blog post about shares in Fileover Cluster scopes.My significantly shortened version looks like this:
Usage is trivial:
The
ShareFolder
function returns 0 upon successful execution and finishes instantly, even with quotas enabled. To be run on one of the cluster nodes hosting the CAP / file server resource. You might have to fix share ACLs afterwards, as the default share creation ACL is justEveryone:Read
and cannot be specified with this method.