How to Install the Windows File Server Role with PowerShell
Applies to: Windows Server 2019, 2022 and 2025.
The File Server role provides managed SMB file sharing. Install it before creating production shares and combine it with a permissions, backup and monitoring plan.
Storage changes can cause data loss or access outages. Use tested backups, maintenance windows and representative access tests. Managed Windows VPS services are available at networkmanager.info.
Prerequisites
- Attach and format the approved data volume.
- Choose a folder and share naming standard.
- Create role-based AD security groups.
- Verify backup capacity.
Procedure
Step 1: Inspect role state
Query file-service features.
Get-WindowsFeature FS-*Step 2: Install File Server
Add the core role.
Install-WindowsFeature FS-FileServer -IncludeManagementToolsStep 3: Review SMB service
Confirm LanmanServer is running.
Get-Service LanmanServerStep 4: Create data hierarchy
Create folders on the dedicated data volume, not inside user profile paths.
New-Item -ItemType Directory -Path 'D:\Shares\Departments' -ForceStep 5: Add monitoring and backup
Protect data before onboarding users.
Verification
Confirm role, service and data volume state.
Get-WindowsFeature FS-FileServer
Get-Service LanmanServer
Get-VolumeRollback and recovery
Remove production shares and migrate data before Uninstall-WindowsFeature FS-FileServer. Never uninstall while clients or applications use the service.
Operational notes
Role installation does not automatically secure folders, create shares or configure backups.