Pour créer une arborescence de dossier en Powershell il existe de multiples façons:
[powershell]New-Item “C:\MySharedFolder" –type directory[/powershell]
— ou encore —
[powershell]
$Folders = "C:\MySharedFolder","C:\MySharedFolder2","C:\MySharedFolder3"
md $Folders – force
[/powershell]
Si ensuite, vous souhaitez partager ce dossier, utilisez la commande New-SMBShare :
[powershell]
New-SMBShare –Name "Shared" –Path "C:\MySharedFolder" `
–FullAccess domain\admingroup `
-ChangeAccess domain\FinanceUsers `
-ReadAccess "domain\authenticated users"
[/powershell]
Parameter Name |
Input Type |
Required |
Description |
CATimeout | Integer | No | How many seconds to wait before failing. |
CachingMode | Choice: None, Manual, Documents, Programs, BranchCache, Unknown |
No | The caching policy for the share. |
ChangeAccess | String or String Array | No | Users to grant Read/Write access to. |
Concurrent User Limit | Integer | No | How many users can access the share at a time. |
ContinuouslyAvailable | Boolean (switch) | No | Whether to keep the share after the next reboot. |
Description | String | No | Friendly description of the share. |
EncryptData | Boolean (switch) | No | Use to turn on file encryption. |
FolderEnumerationMode | Choice: AccessBased, Unrestricted |
No | Choose when folders are enumerated (listed) in the share. |
FullAccess | String or String Array | No | Users to grant Full control to. |
Name | String | Yes | Name of the share. |
NoAccess | String or String Array | No | Users to deny access to. |
Path | String | Yes | The file path to the shared folder. |
ReadAccess | String or String Array | No | Users to grant Read Only access to. |
ScopeName | String | No | Name of the endpoint that the share is scoped to. |
Temporary | Boolean (switch) | No | Share removed after reboot. |
ThrottleLimit | Integer | No | Limit the resources of the share. |
AsJob | Boolean (switch) | No | Create a Job to background process this command |
couco
10 février 2017 at 11h17
nul
MARCHE PO
Thomas Delahaye
29 mars 2017 at 21h01
Bonsoir,
Le paramètre –ContinuouslyAvailable ne fonctionne pas toujours.
Supprimez-le et tout ira bien.
Thomas