We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 205056b commit be9e155Copy full SHA for be9e155
1 file changed
DSCResources/DSR_IniSettingsFile/DSR_IniSettingsFile.psm1
@@ -220,6 +220,12 @@ function Test-TargetResource
220
221
Assert-ParametersValid @PSBoundParameters
222
223
+ # Check if file being managed exists. If not return $False.
224
+ if (-not (Test-Path -Path $Path))
225
+ {
226
+ return $false
227
+ }
228
+
229
if ($Type -eq 'Secret')
230
{
231
$Text = $Secret.GetNetworkCredential().Password
@@ -306,8 +312,9 @@ function Assert-ParametersValid
306
312
$Secret
307
313
)
308
314
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))
311
318
319
New-InvalidArgumentException `
320
-Message ($localizedData.FileNotFoundError -f $Path) `
0 commit comments