Skip to content
THIS MODULE HAS BEEN DEPRECATED Please use ComputerManagementDsc/SmbShare instead: https://github.com/PowerShell/ComputerManagementDsc
PowerShell
Branch: dev
Clone or download

README.md

THIS MODULE HAS BEEN DEPRECATED

It will no longer be released. Please use the 'SmbShare' resource in ComputerManagementDsc instead.

xSmbShare Resource

Build status

The xSmbShare module contains the xSmbShare DSC resource for setting up and configuring an SMB share.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Contributing

Please check out common DSC Resources contributing guidelines.

Resources

xSmbShare

  • 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.
  • CachingMode: Specifies the caching mode of the offline files for the SMB share. { 'None' | 'Manual' | 'Programs' | 'Documents' | 'BranchCache' }
  • 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.

Versions

Unreleased

  • THIS MODULE HAS BEEN DEPRECATED. This resource module will no longer be released. Please use the resource 'SmbShare' in the ComputerManagementDsc module instead.

2.2.0.0

  • Improved Code logic & cosmetic changes
  • Update appveyor.yml to use the default template.
  • Added default template files .codecov.yml, .gitattributes, and .gitignore, and .vscode folder.
  • Changes to xSmbShare

2.1.0.0

  • Corrected typo on ShareState and ShareType descriptions (Specfies -> Specifies)

2.0.0.0

  • Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey.
  • Added default value of "Present" for the Ensure parameter. (Note: due to how the module's logic is written, this is a breaking change; DSC configs that did not specify a value for Ensure would have behaved as though it were set to Present in the Test-TargetResource function, but to absent in Set-TargetResource, removing the share instead of creating it.)

1.1.0.0

  • Fixed bug in xSmbShare resource which was causing Test-TargetResource to return false negatives when more than three parameters were specified.

1.0.0.0

  • Initial release with the following resources
    • xSmbShare

Examples

Ensure the an SMB share exists

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

Ensure description and permissions for a share

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

Remove an SMB share

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
You can’t perform that action at this time.