@@ -26,11 +26,6 @@ trap {
26
26
Write-DscTrace - Operation Debug - Message ($_ | Format-List - Force | Out-String )
27
27
}
28
28
29
- # Adding some debug info to STDERR
30
- ' PSVersion=' + $PSVersionTable.PSVersion.ToString () | Write-DscTrace
31
- ' PSPath=' + $PSHome | Write-DscTrace
32
- ' PSModulePath=' + $env: PSModulePath | Write-DscTrace
33
-
34
29
if ($Operation -eq ' ClearCache' ) {
35
30
$cacheFilePath = if ($IsWindows ) {
36
31
# PS 6+ on Windows
@@ -44,11 +39,15 @@ if ($Operation -eq 'ClearCache') {
44
39
}
45
40
}
46
41
47
- ' Deleting cache file ' + $cacheFilePath | Write-DscTrace
48
42
Remove-Item - Force - ea SilentlyContinue - Path $cacheFilePath
49
43
exit 0
50
44
}
51
45
46
+ # Adding some debug info to STDERR
47
+ ' PSVersion=' + $PSVersionTable.PSVersion.ToString () | Write-DscTrace
48
+ ' PSPath=' + $PSHome | Write-DscTrace
49
+ ' PSModulePath=' + $env: PSModulePath | Write-DscTrace
50
+
52
51
if ($PSVersionTable.PSVersion.Major -le 5 ) {
53
52
# For Windows PowerShell, we want to remove any PowerShell 7 paths from PSModulePath
54
53
$env: PSModulePath = ($env: PSModulePath -split ' ;' | Where-Object { $_ -notlike ' *\powershell\*' }) -join ' ;'
@@ -87,7 +86,7 @@ switch ($Operation) {
87
86
88
87
# cache was refreshed on script load
89
88
foreach ($dscResource in $dscResourceCache ) {
90
-
89
+
91
90
# https://learn.microsoft.com/dotnet/api/system.management.automation.dscresourceinfo
92
91
$DscResourceInfo = $dscResource.DscResourceInfo
93
92
@@ -99,7 +98,7 @@ switch ($Operation) {
99
98
if ($DscResourceInfo.Capabilities ) {
100
99
$capabilities = $DscResourceInfo.Capabilities
101
100
} elseif ($module.PrivateData.PSData.DscCapabilities ) {
102
-
101
+
103
102
$capabilities = $module.PrivateData.PSData.DscCapabilities
104
103
} else {
105
104
$capabilities = @ (' get' , ' set' , ' test' )
@@ -183,7 +182,7 @@ switch ($Operation) {
183
182
}
184
183
$result += $actualState
185
184
}
186
-
185
+
187
186
# OUTPUT json to stderr for debug, and to stdout
188
187
if ($Operation -eq ' Test' ) {
189
188
$result = @ { result = $result ; _inDesiredState = $inDesiredState } | ConvertTo-Json - Depth 10 - Compress
@@ -196,7 +195,7 @@ switch ($Operation) {
196
195
}
197
196
' Validate' {
198
197
# VALIDATE not implemented
199
-
198
+
200
199
# OUTPUT
201
200
@ { valid = $true } | ConvertTo-Json
202
201
}
0 commit comments