From 0adcbf8bf62c2f62da0d432c9cf08ef503faa091 Mon Sep 17 00:00:00 2001 From: Brian Gouldman Date: Wed, 31 Jan 2018 12:39:45 -0500 Subject: [PATCH] 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. --- DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1 | 6 +++++- DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1 b/DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1 index 4252051..5e48123 100644 --- a/DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1 +++ b/DscResources/NTFSAccessEntry/NTFSAccessEntry.psm1 @@ -117,6 +117,8 @@ Function Set-TargetResource $Force = $false ) + $ACLRules = @() + $inputPath = Get-InputPath($Path) if(Test-Path -Path $inputPath) @@ -274,6 +276,8 @@ Function Test-TargetResource $Force = $false ) + $ACLRules = @() + $InDesiredState = $True $inputPath = Get-InputPath($Path) @@ -598,7 +602,7 @@ Function Compare-NtfsRule foreach($refrenceObject in $Actual) { - $match = $Expected.Rules.Where({ + $match = @($Expected.Rules).Where({ (((($_.FileSystemRights.value__ -band $refrenceObject.FileSystemRights.value__) -match "$($_.FileSystemRights.value__)|$($refrenceObject.FileSystemRights.value__)") -and !$Force) -or ($_.FileSystemRights -eq $refrenceObject.FileSystemRights -and $Force)) -and $_.InheritanceFlags -eq $refrenceObject.InheritanceFlags -and $_.PropagationFlags -eq $refrenceObject.PropagationFlags -and diff --git a/DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1 b/DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1 index 3fb6578..b9e5200 100644 --- a/DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1 +++ b/DscResources/RegistryAccessEntry/RegistryAccessEntry.psm1 @@ -113,6 +113,8 @@ Function Set-TargetResource $Force = $false ) + $ACLRules = @() + if(-not (Test-Path -Path $Path)) { $errorMessage = $LocalizedData.ErrorPathNotFound -f $Path @@ -236,6 +238,8 @@ Function Test-TargetResource $Force = $false ) + $ACLRules = @() + if(-not (Test-Path -Path $Path)) { $LocalizedData.ErrorPathNotFound -f $Path | Write-Verbose @@ -384,7 +388,7 @@ Function Compare-RegistryRule foreach($refrenceObject in $Actual) { - $match = $Expected.Rules.Where({ + $match = @($Expected.Rules).Where({ $_.RegistryRights -eq $refrenceObject.RegistryRights -and $_.InheritanceFlags -eq $refrenceObject.InheritanceFlags -and $_.PropagationFlags -eq $refrenceObject.PropagationFlags -and