Skip to content

Commit bfd7cf5

Browse files
bgouldmanregedit32
authored andcommitted
Updated issue with ACLRules not always being an array when trying to add additional objects. Updated issue where Expected.Rules might only be a single object while trying to call a Where extension method. (#31)
1 parent 4ea1902 commit bfd7cf5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1

+5-1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ Function Set-TargetResource
117117
$Force = $false
118118
)
119119

120+
$ACLRules = @()
121+
120122
$inputPath = Get-InputPath($Path)
121123

122124
if(Test-Path -Path $inputPath)
@@ -274,6 +276,8 @@ Function Test-TargetResource
274276
$Force = $false
275277
)
276278

279+
$ACLRules = @()
280+
277281
$InDesiredState = $True
278282
$inputPath = Get-InputPath($Path)
279283

@@ -598,7 +602,7 @@ Function Compare-NtfsRule
598602

599603
foreach($refrenceObject in $Actual)
600604
{
601-
$match = $Expected.Rules.Where({
605+
$match = @($Expected.Rules).Where({
602606
(((($_.FileSystemRights.value__ -band $refrenceObject.FileSystemRights.value__) -match "$($_.FileSystemRights.value__)|$($refrenceObject.FileSystemRights.value__)") -and !$Force) -or ($_.FileSystemRights -eq $refrenceObject.FileSystemRights -and $Force)) -and
603607
$_.InheritanceFlags -eq $refrenceObject.InheritanceFlags -and
604608
$_.PropagationFlags -eq $refrenceObject.PropagationFlags -and

DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Function Set-TargetResource
113113
$Force = $false
114114
)
115115

116+
$ACLRules = @()
117+
116118
if(-not (Test-Path -Path $Path))
117119
{
118120
$errorMessage = $LocalizedData.ErrorPathNotFound -f $Path
@@ -236,6 +238,8 @@ Function Test-TargetResource
236238
$Force = $false
237239
)
238240

241+
$ACLRules = @()
242+
239243
if(-not (Test-Path -Path $Path))
240244
{
241245
$LocalizedData.ErrorPathNotFound -f $Path | Write-Verbose
@@ -384,7 +388,7 @@ Function Compare-RegistryRule
384388

385389
foreach($refrenceObject in $Actual)
386390
{
387-
$match = $Expected.Rules.Where({
391+
$match = @($Expected.Rules).Where({
388392
$_.RegistryRights -eq $refrenceObject.RegistryRights -and
389393
$_.InheritanceFlags -eq $refrenceObject.InheritanceFlags -and
390394
$_.PropagationFlags -eq $refrenceObject.PropagationFlags -and

0 commit comments

Comments
 (0)