@@ -26,11 +26,6 @@ trap {
2626 Write-DscTrace - Operation Debug - Message ($_ | Format-List - Force | Out-String )
2727}
2828
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-
3429if ($Operation -eq ' ClearCache' ) {
3530 $cacheFilePath = if ($IsWindows ) {
3631 # PS 6+ on Windows
@@ -44,11 +39,15 @@ if ($Operation -eq 'ClearCache') {
4439 }
4540 }
4641
47- ' Deleting cache file ' + $cacheFilePath | Write-DscTrace
4842 Remove-Item - Force - ea SilentlyContinue - Path $cacheFilePath
4943 exit 0
5044}
5145
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+
5251if ($PSVersionTable.PSVersion.Major -le 5 ) {
5352 # For Windows PowerShell, we want to remove any PowerShell 7 paths from PSModulePath
5453 $env: PSModulePath = ($env: PSModulePath -split ' ;' | Where-Object { $_ -notlike ' *\powershell\*' }) -join ' ;'
@@ -87,7 +86,7 @@ switch ($Operation) {
8786
8887 # cache was refreshed on script load
8988 foreach ($dscResource in $dscResourceCache ) {
90-
89+
9190 # https://learn.microsoft.com/dotnet/api/system.management.automation.dscresourceinfo
9291 $DscResourceInfo = $dscResource.DscResourceInfo
9392
@@ -99,7 +98,7 @@ switch ($Operation) {
9998 if ($DscResourceInfo.Capabilities ) {
10099 $capabilities = $DscResourceInfo.Capabilities
101100 } elseif ($module.PrivateData.PSData.DscCapabilities ) {
102-
101+
103102 $capabilities = $module.PrivateData.PSData.DscCapabilities
104103 } else {
105104 $capabilities = @ (' get' , ' set' , ' test' )
@@ -183,7 +182,7 @@ switch ($Operation) {
183182 }
184183 $result += $actualState
185184 }
186-
185+
187186 # OUTPUT json to stderr for debug, and to stdout
188187 if ($Operation -eq ' Test' ) {
189188 $result = @ { result = $result ; _inDesiredState = $inDesiredState } | ConvertTo-Json - Depth 10 - Compress
@@ -196,7 +195,7 @@ switch ($Operation) {
196195 }
197196 ' Validate' {
198197 # VALIDATE not implemented
199-
198+
200199 # OUTPUT
201200 @ { valid = $true } | ConvertTo-Json
202201 }
0 commit comments