< Back

Install-CFileShare

Sun Jan 12, 2020 10:14 pm

NAME Install-CFileShare



SYNOPSIS

Installs a file/SMB share.





SYNTAX

Install-CFileShare [-Name] <String> [-Path] <String> [[-Description] <String>] [[-FullAccess] <String[]>]

[[-ChangeAccess] <String[]>] [[-ReadAccess] <String[]>] [-Force] [<CommonParameters>]





DESCRIPTION

The `Install-CFileShare` 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-CPermission` to grant file system

permissions.



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





PARAMETERS

-Name <String>

The share's name.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

The path to the share.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>

A description of the share



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-FullAccess <String[]>

The identities who have full access to the share.



Required? false

Position? 4

Default value @()

Accept pipeline input? false

Accept wildcard characters? false



-ChangeAccess <String[]>

The identities who have change access to the share.



Required? false

Position? 5

Default value @()

Accept pipeline input? false

Accept wildcard characters? false



-ReadAccess <String[]>

The identities who have read access to the share



Required? false

Position? 6

Default value @()

Accept pipeline input? false

Accept wildcard characters? 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.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>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.











RELATED LINKS

Get-CFileShare

Get-CFileSharePermission

Grant-CPermission

Test-CFileShare

Uninstall-CFileShare