Skip to content

Commit be9e155

Browse files
committed
End of day push
1 parent 205056b commit be9e155

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

DSCResources/DSR_IniSettingsFile/DSR_IniSettingsFile.psm1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ function Test-TargetResource
220220

221221
Assert-ParametersValid @PSBoundParameters
222222

223+
# Check if file being managed exists. If not return $False.
224+
if (-not (Test-Path -Path $Path))
225+
{
226+
return $false
227+
}
228+
223229
if ($Type -eq 'Secret')
224230
{
225231
$Text = $Secret.GetNetworkCredential().Password
@@ -306,8 +312,9 @@ function Assert-ParametersValid
306312
$Secret
307313
)
308314

309-
# Does the file in path exist?
310-
if (-not (Test-Path -Path $Path))
315+
# Does the file in parent path exist?
316+
$parentPath = Split-Path -Path $Path -Parent
317+
if (-not (Test-Path -Path $parentPath))
311318
{
312319
New-InvalidArgumentException `
313320
-Message ($localizedData.FileNotFoundError -f $Path) `

0 commit comments

Comments
 (0)