Installs a file/SMB share.


Install-FileShare [-Name] <String> [-Path] <String> [[-Description] <String>] [[-FullAccess] <String[]>] [[-ChangeAccess] <String[]>] [[-ReadAccess] <String[]>] [-Force] [<CommonParameters>]


The Install-FileShare function installs a new file/SMB share. If the share doesn't exist, it is created. In Carbon 2.0, if a share does exist, its properties and permissions are updated in place, unless the share's path needs to change. Changing a share's path requires deleting and re-creating. Before Carbon 2.0, shares were always deleted and re-created.

Use the FullAccess, ChangeAccess, and ReadAccess parameters to grant full, change, and read sharing permissions on the share. Each parameter takes a list of user/group names. If you don't supply any permissions, Everyone will get Read access. Permissions on existing shares are cleared before permissions are granted. Permissions don't apply to the file system, only to the share. Use Grant-Permission to grant file system permissions.

Before Carbon 2.0, this function was called Install-SmbShare.

Related Commands


Name Type Description Required? Pipeline Input Default Value
Name String

The share's name.

true false
Path String

The path to the share.

true false
Description String

A description of the share

false false
FullAccess String[]

The identities who have full access to the share.

false false @()
ChangeAccess String[]

The identities who have change access to the share.

false false @()
ReadAccess String[]

The identities who have read access to the share

false false @()
Force SwitchParameter

Deletes the share and re-creates it, if it exists. Preserves default beheavior in Carbon before 2.0.

The Force switch is new in Carbon 2.0.

false false False


Install-Share -Name TopSecretDocuments -Path C:\TopSecret -Description 'Share for our top secret documents.' -ReadAccess "Everyone" -FullAccess "Analysts"

Shares the C:\TopSecret directory as TopSecretDocuments and grants Everyone read access and Analysts full control.