The xSmbShare module contains the xSmbShare DSC resource for setting up and configuring an SMB share.
Please check out common DSC Resources contributing guidelines.
- Name: Name of the SMB share.
- Path: Path to the share.
- Description: Description of the share.
- ChangeAccess: Specifies which user will be granted modify permission to access the share.
- ConcurrentUserLimit: Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to 0, then the number of users is unlimited. The default value is 0.
- EncryptData: Indicates that the share is encrypted.
- FolderEnumerationMode: Specifies which files and folders in the new SMB share are visible to users.
- FullAccess: Specifies which accounts are granted full permission to access the share.
- NoAccess: Specifies which accounts are denied access to the share.
- ReadAccess: Specifies which accounts are granted read permission to access the share.
- Ensure: Specifies if the share should be added or removed.
- ShareState: State of the share.
- ShareType: Type of the share.
- ShadowCopy: Specifies if this share is a ShadowCopy.
- Special: Specifies if this share is a Special Share. Admin shares, default shares, IPC$ share are examples.
- Fixed bug in xSmbShare resource which was causing Test-TargetResource to return false negatives when more than three parameters were specified.
- Initial release with the following resources
- xSmbShare
This configuration ensures that there is a share with the description of "This is a test SMB Share".
Configuration ChangeDescriptionConfig
{
Import-DscResource -Name MSFT_xSmbShare
# A Configuration block can have zero or more Node blocks
Node localhost
{
xSmbShare MySMBShare
{
Ensure = "Present"
Name = "SMBShare1"
Path = "C:\Users\Duser1\Desktop"
Description = "This is a test SMB Share"
}
}
}
ChangeDescriptionConfig
This configuration ensures that the description and permissions for a share are as specified.
Configuration ChangeDescriptionAndPermissionsConfig
{
Import-DscResource -Name MSFT_xSmbShare
# A Configuration block can have zero or more Node blocks
Node localhost
{
# Next, specify one or more resource blocks
xSmbShare MySMBShare
{
Ensure = "Present"
Name = "SMBShare1"
Path = "C:\Users\Duser1\Desktop"
ReadAccess = "User1"
NoAccess = @("User3", "User4")
Description = "This is an updated description for this share"
}
}
}
ChangeDescriptionAndPermissionsConfig
This example ensures that the SMB share used in the previous examples does not exist.
Configuration RemoveSmbShareConfig
{
Import-DscResource -Name MSFT_xSmbShare
# A Configuration block can have zero or more Node blocks
Node localhost
{
# Next, specify one or more resource blocks
xSmbShare MySMBShare
{
Ensure = "Absent"
Name = "SMBShare1"
Path = "C:\Users\Duser1\Desktop"
}
}
}
RemoveSmbShareConfig