Create a File Share in Windows Server 2016 - WindowsTips.net - Windows Tips and Tricks with Geek

Thursday, June 24, 2021

Create a File Share in Windows Server 2016

 

File Explorer

The method that's familiar to most Windows systems administrators is to right-click the target folder, select Properties from the shortcut menu, and navigate to the Sharing tab. You then click Advanced Sharing, enable Share this folder, and click Permissions to adjust the folder's access control list (ACL).

The "tried and true" File Explorer method for sharing a folder in Windows Server.

You'll note that the default shared folder permission is to grant the Everyone special identity Read access. The current best practice is actually to grant Everyone (or at least Authenticated Users) Full Control.

The reason for this guidance lies in how NTFS permissions combine with shared folder permissions. By setting the shared folder permissions wide open, we are free to set more restrictive permissions granularly using NTFS security. That’s because the effective permission is the most restrictive permission between the two access lists.

Windows PowerShell

If you haven’t begun mastering Windows PowerShell, then you're already late to the party. Open an elevated Windows PowerShell console session by right-clicking the PowerShell icon in the Start menu or taskbar and selecting Run as Administrator from the shortcut menu.

The New-SmbShare cmdlet is available in Windows Powershell v4 or later; of course, Windows Server 2016 includes Windows PowerShell v5.1. Try the following:
New-SmbShare -Name scripts -Path 'E:scripts' -FullAccess Everyone

You can actually do a lot with SMB file shares by using PowerShell; let's run Get-Command to see what's available:

Get-Command -Noun SmbShare | Select-Object -Property Name
Name
----
Get-SmbShare
New-SmbShare
Remove-SmbShare
Set-SmbShare

Server Manager

As long as your Windows Server 2016 server has the File Server role installed, you can use Server Manager to create and manage file shares. Run the following PowerShell "one-liner" to determine whether the role's installed:
Get-WindowsFeature -Name FS-FileServer

If not, then you can install the role quickly and easily with the following command:
Install-WindowsFeature -Name FS-FileServer -IncludeAllSubFeature -IncludeManagementTools

You can start Server Manager from PowerShell simply by typing servermanager and pressing Enter.

In Server Manager, select the File and Storage Services node, and then Shares in the submenu. As shown in the following screenshot, creating a new file share is as easy as choosing New Share from the Tasks menu and then completing the New Share Wizard.

You'll note that the Server Manager New Share Wizard gives you more flexibility in creating shares than the two previously described methods. For instance, you can create Network File System (NFS) shares that are compatible with Linux computers

No comments:

Post a Comment