Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# create a folder for sharing
PS C:\Users\Administrator> mkdir D:\ShareAll
Directory: D:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/18/2019 9:41 PM ShareAll
# set sharing
# -Name [share name you like]
# -Path [path of shared folder]
# -FullAccess [users or groups that is granted full-control permission]
PS C:\Users\Administrator> New-SmbShare -Name "ShareAll" -Path "D:\ShareAll" -FullAccess "Everyone"
Name ScopeName Path Description
---- --------- ---- -----------
ShareAll * D:\ShareAll
# grant NTFS permission
PS C:\Users\Administrator> icacls "D:\ShareAll" /grant "Everyone:(OI)(CI)(F)"
processed file: D:\ShareAll
Successfully processed 1 files; Failed processing 0 files
# confirm settings
PS C:\Users\Administrator> Get-SmbShare -Name "ShareAll" | Format-List -Property *
PresetPathAcl : System.Security.AccessControl.DirectorySecurity
ShareState : Online
AvailabilityType : NonClustered
ShareType : FileSystemDirectory
FolderEnumerationMode : Unrestricted
CachingMode : Manual
LeasingMode : Full
SmbInstance : Default
CATimeout : 0
ConcurrentUserLimit : 0
ContinuouslyAvailable : False
CurrentUsers : 0
Description :
EncryptData : False
IdentityRemoting : False
Infrastructure : False
Name : ShareAll
Path : D:\ShareAll
Scoped : False
PSComputerName :
CimClass : ROOT/Microsoft/Windows/SMB:MSFT_SmbShare
CimInstanceProperties : {AvailabilityType, CachingMode, CATimeout, ConcurrentUserLimit...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
|