Windows Servers

How to Set Up a File Server on Windows Server

By NileVPS Team · Published · 4 min read

اقرأ المقال بالعربي

A file server is one of the oldest jobs a Windows server does, and still one of the most useful: a single place where a team stores documents, with permissions that decide who sees what, quotas that stop one folder from eating the disk, and shadow copies that let users undo their own mistakes. This guide sets up a clean file server on Windows Server 2019 or 2022, from installing the role to locking down access, with PowerShell commands for every step.

Plan the layout first

Before creating shares, decide three things:

  • Where the data lives. Keep shared data on its own volume (for example D:), never on the system drive. This simplifies backups, quotas and growth.
  • How folders map to teams. A common pattern is one top-level share, such as D:\Shares\Company, with subfolders per department.
  • How access is granted. Grant permissions to groups, not to individual users. When someone joins or leaves, you change group membership instead of editing folder permissions.

Install the file server role

The basic SMB file server is part of every Windows Server installation, but the role service and the management tools are worth installing explicitly, together with File Server Resource Manager (FSRM):

Install-WindowsFeature FS-FileServer, FS-Resource-Manager -IncludeManagementTools

FSRM adds quotas, file screening and storage reports. Shares are managed in Server Manager under File and Storage Services > Shares, or entirely from PowerShell.

Create the folder structure and groups

New-Item -Path D:\Shares\Company\Finance -ItemType Directory -Force
New-Item -Path D:\Shares\Company\Sales -ItemType Directory -Force

New-LocalGroup -Name "FS-Finance-RW"
New-LocalGroup -Name "FS-Sales-RW"
Add-LocalGroupMember -Group "FS-Finance-RW" -Member "amira"

On a domain, create these as domain security groups in Active Directory instead of local groups.

Share permissions vs NTFS permissions

Windows checks two separate layers when someone opens a file over the network:

LayerApplies toGranularity
Share permissionsNetwork access onlyFull Control, Change, Read on the whole share
NTFS permissionsNetwork and local accessFine-grained, per folder and file, with inheritance

The effective permission is the more restrictive of the two. The cleanest practice is to keep share permissions broad (for example, Authenticated Users: Full Control or Change) and do all the real access control with NTFS permissions. That way there is one place to look when troubleshooting.

Create the SMB share

New-SmbShare -Name "Company" -Path "D:\Shares\Company" `
  -FullAccess "Administrators" -ChangeAccess "Authenticated Users" `
  -FolderEnumerationMode AccessBased

-FolderEnumerationMode AccessBased enables Access-Based Enumeration: users only see the folders they have permission to open, which keeps the share tidy and avoids curiosity clicks.

Set NTFS permissions with icacls

Disable inheritance on each department folder, then grant the right groups:

icacls "D:\Shares\Company\Finance" /inheritance:d
icacls "D:\Shares\Company\Finance" /remove "Users"
icacls "D:\Shares\Company\Finance" /grant "FS-Finance-RW:(OI)(CI)M"
  • (OI)(CI) makes the permission apply to subfolders and files.
  • M is Modify, which lets users create, edit and delete files without changing permissions. Avoid giving Full Control to ordinary users.

Check the result with the Effective Access tab in the folder's Advanced Security Settings. Our guide to Windows Server permissions covers this model in more depth.

Add quotas with FSRM

A quota stops a folder from filling the volume:

New-FsrmQuota -Path "D:\Shares\Company\Sales" -Size 50GB -Description "Sales hard limit"

Use a soft quota (-SoftLimit) if you want warnings without blocking writes. FSRM file screens can also block file types you do not want on the server, such as executables in a documents share.

Enable shadow copies

Shadow Copies for Shared Folders lets users right-click a file and choose Restore previous versions. Enable it per volume in the volume's Properties > Shadow Copies tab, set a schedule (for example 7:00 and 12:00 on weekdays), and give it enough storage. Shadow copies are not a backup, because they live on the same disk, but they handle most "I overwrote my file" requests without involving an administrator.

Secure the file server

  • Never expose SMB (TCP 445) to the internet. On a VPS, block port 445 in both the Windows Firewall and the cloud firewall, and let remote users connect through a VPN.
  • Disable SMBv1, which is obsolete and insecure: Set-SmbServerConfiguration -EnableSMB1Protocol $false.
  • Require encryption on sensitive shares: Set-SmbShare -Name "Company" -EncryptData $true.
  • Audit access to sensitive folders so you know who changed or deleted what.
  • Back up the data volume on a schedule and test restores.

Quick verification

From a client, map the share and test access with different users:

New-PSDrive -Name S -PSProvider FileSystem -Root "\\FILESRV01\Company" -Persist
Get-SmbSession   # on the server: who is connected
Get-SmbOpenFile  # on the server: which files are open

If you need a Windows machine to host shared files for a remote team, compare plans on our pricing page and size the data volume for growth.

FAQ

Should I use share permissions or NTFS permissions?

Use both, but keep share permissions simple and broad and put the detailed rules in NTFS permissions. The effective result is always the more restrictive of the two, so managing access in one layer avoids confusing conflicts.

Can I use a Windows VPS as a file server for an office?

Yes, as long as access goes through a VPN or another private channel rather than exposing SMB publicly. Consider latency for large files and keep regular backups outside the server.

Are shadow copies enough as a backup?

No. Shadow copies sit on the same volume as the data, so a disk failure, ransomware or a deleted volume takes them too. Treat them as a convenience for quick restores and keep real backups elsewhere.

Related guides