How does New-SmbShare know whether the new share should be standalone, clustered or scale-out?

I got a question the other day about one of the scripts I published as part of a step-by-step for Hyper-V over SMB, Here's the relevant line from that script:

New-SmbShare -Name VMS3 -Path C:ClusterStorageVolume1VMS -FullAccess FST2.TestAdministrator, FST2.TestFST2-HV1$, FST2.TestFST2-HV2$, FST2.TestFST2-HVC$

The question was related to how does New-SmbShare know to create the share on the cluster as a continuously available share. Nothing in the cmdlet or its parameters tells it that. So the puzzled reader was asking what did he miss. It worked, but he could not figure out how.

The answer is quite simple, although it's not obvious. This is done automatically based on where the folder (specified the -Path parameter) lives.

Here are the rules:

  • If the path is on a local, nonclustered disk, New-SmbShare creates a standalone share
  • If the path is on a classic cluster disk, New-SmbShare creates a classic cluster file share on the group that owns that disk.
  • if the path is on a clustered shared volume (CSV), it creates a scale-out file share.

There is actually a -ScopeName parameter for New-SmbShare, which can be used to specify the cluster name (either the netname for a classic cluster or the DNN for a Scale-Out cluster), but in most cases this is entirely optional.

There is also a -ContinuoulyAvailable parameter, but it automatically defaults to $true if the share is on a cluster, so it also optional (unless you want to create a non-CA share on a cluster - not a good idea anyway).

You can read more about these automatic behaviors in SMB 3.0 at https://blogs.technet.com/b/josebda/archive/2012/10/08/windows-server-2012-file-servers-and-smb-3-0-simpler-and-easier-by-design.aspx

For more details about SMB PowerShell cmdlets, check out https://blogs.technet.com/b/josebda/archive/2012/06/27/the-basics-of-smb-powershell-a-feature-of-windows-server-2012-and-smb-3-0.aspx?Redirected=true