Skip to content

Commit

Permalink
Merge pull request #1 from PowerShell/master
Browse files Browse the repository at this point in the history
Pulling updates from upstream
  • Loading branch information
Alexei Andreyev committed Nov 11, 2015
2 parents b2ac6e4 + 8aaa383 commit 1cbbdbb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
26 changes: 14 additions & 12 deletions DscResources/MSFT_xSmbShare/MSFT_xSmbShare.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -315,27 +315,29 @@ function Test-TargetResource
$Ensure
)
$testResult = $false;
$share = Get-SmbShare -Name $Name -ErrorAction SilentlyContinue -ErrorVariable ev
if ($Ensure -eq "Present")
$share = Get-TargetResource -Name $Name -Path $Path -ErrorAction SilentlyContinue -ErrorVariable ev
if ($Ensure -ne "Absent")
{
if ($share -eq $null)
if ($share.Ensure -eq "Absent")
{
$testResult = $false
}
elseif ($share -ne $null -and $PSBoundParameters.Count -gt 3)
# This means some other parameter in addition to Name, Path, Ensure could have been specified
# Which means we need to modify something
{
$testResult = $false
}
else
elseif ($share.Ensure -eq "Present")
{
$testResult = $true
$Params = 'Name', 'Path', 'Description', 'ChangeAccess', 'ConcurrentUserLimit', 'EncryptData', 'FolderEnumerationMode', 'FullAccess', 'NoAccess', 'ReadAccess', 'Ensure'
if ($PSBoundParameters.Keys.Where({$_ -in $Params}) | ForEach-Object {Compare-Object -ReferenceObject $PSBoundParameters.$_ -DifferenceObject $share.$_})
{
$testResult = $false
}
else
{
$testResult = $true
}
}
}
else
{
if ($share -eq $null)
if ($share.Ensure -eq "Absent")
{
$testResult = $true
}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Admin shares, default shares, IPC$ share are examples.

## Versions

### 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
Expand Down
2 changes: 1 addition & 1 deletion xSmbShare.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
# Version number of this module.
ModuleVersion = '1.0.1'
ModuleVersion = '1.1.0.0'

# ID used to uniquely identify this module
GUID = '8831ca9a-3c47-4a5b-b401-29635dd24381'
Expand Down

0 comments on commit 1cbbdbb

Please sign in to comment.