diff --git a/lib/ansible/modules/windows/win_share.ps1 b/lib/ansible/modules/windows/win_share.ps1 index 7eaabc2820..955bf4a856 100644 --- a/lib/ansible/modules/windows/win_share.ps1 +++ b/lib/ansible/modules/windows/win_share.ps1 @@ -67,7 +67,7 @@ Function UserSearch $Searcher.Filter = "userPrincipalName=$($accountName)" } - $result = $Searcher.FindOne() + $result = $Searcher.FindOne() if ($result) { $user = $result.GetDirectoryEntry() @@ -138,6 +138,8 @@ Try { $permissionFull = Get-AnsibleParam -obj $params -name "full" -type "str" -default "" | NormalizeAccounts $permissionDeny = Get-AnsibleParam -obj $params -name "deny" -type "str" -default "" | NormalizeAccounts + $cachingMode = Get-Attr $params "caching_mode" "" -validateSet "BranchCache","Documents","Manual","None","Programs", "Unkown" + If (-Not (Test-Path -Path $path)) { Fail-Json $result "$path directory does not exist on the host" } @@ -170,6 +172,10 @@ Try { Set-SmbShare -Force -Name $name -FolderEnumerationMode $folderEnum $result.changed = $true } + if ($share.CachingMode -ne $cachingMode) { + Set-SmbShare -Force -Name $name -CachingMode $cachingMode + Set-Attr $result "changed" $true; + } # clean permissions that imply others ForEach ($user in $permissionFull) { diff --git a/lib/ansible/modules/windows/win_share.py b/lib/ansible/modules/windows/win_share.py index fb9f72fef5..fc4b4c5fc8 100644 --- a/lib/ansible/modules/windows/win_share.py +++ b/lib/ansible/modules/windows/win_share.py @@ -84,7 +84,18 @@ options: - Specify user list that should get no access, regardless of implied access on share, separated by comma. required: no default: none -author: Hans-Joachim Kliemeck (@h0nIg) + caching_mode: + description: + - Set the CachingMode for this share. + choices: + - BranchCache + - Documents + - Manual + - None + - Programs + - Unknown + required: no +author: Hans-Joachim Kliemeck (@h0nIg), David Baumann (@daBONDi) ''' EXAMPLES = r'''