Share a folder in PowerShell

Windows Server 2016Windows Server 2019Windows Server 2022Windows Server 2025

Create a share with PowerShell:

This tutorial explains how to share a folder in Powershell granting full access to Everyone.

The folder to be shared must already exist on the server.

Open a PowerShell window

On the server, open a PowerShell command prompt as Administrator.

Use the New-SmbShare cmdlet

Enter the following command to create a share. Returning the command will show an equivalent of Get-SmbShare.

New-SmbShare -Name NomDuPartage -Path "C:\Dossier\Sur\LeServeur" -FullAccess "Tout le monde"
New-SmbShare - PowerShell

Verify Sharing

To verify the creation of the share, several possible solutions:

  • Access the UNC path (\\Server\Shared)
  • Use command Get-SmbShare.
  • Check by file explorer.
UNC

It is also possible to verify the creation of the share with the Get-SmbShare command.

Get-SmbShare

If the file server has a graphical interface, it is also possible to see it through the file explorer.

Romain Drouche
System Architect | MCSE: Core Infrastructure
IT infrastructure expert with over 15 years of field experience. Currently a Systems and Networks Project Manager and Information Systems Security (ISS) expert, I use my expertise to ensure the reliability and security of technological environments.

Leave a Comment