Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions powershell-adapter/psDscAdapter/win_psDscAdapter.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if ($PSVersionTable.PSVersion.Major -gt 5) {
$PSDesiredStateConfiguration = Import-Module $m -Force -PassThru
}
else {
$env:PSModulePath += ";$env:windir\System32\WindowsPowerShell\v1.0\Modules"
$env:PSModulePath = "$env:windir\System32\WindowsPowerShell\v1.0\Modules;$env:PSModulePath"
$PSDesiredStateConfiguration = Import-Module -Name 'PSDesiredStateConfiguration' -RequiredVersion '1.1' -Force -PassThru -ErrorAction stop -ErrorVariable $importModuleError
if (-not [string]::IsNullOrEmpty($importModuleError)) {
'Could not import PSDesiredStateConfiguration 1.1 in Windows PowerShell. ' + $importModuleError | Write-DscTrace -Operation Error
Expand Down Expand Up @@ -392,6 +392,9 @@ function Invoke-DscOperation {
}
catch {
$_.Exception | Format-List * -Force | Out-String | Write-DscTrace -Operation Debug
if ($_.Exception.MessageId -eq 'DscResourceNotFound') {
Write-DscTrace -Operation Warn -Message 'For Windows PowerShell, DSC resources must be installed with scope AllUsers'
}
'Exception: ' + $_.Exception.Message | Write-DscTrace -Operation Error
exit 1
}
Expand Down Expand Up @@ -446,7 +449,10 @@ function Invoke-DscOperation {
}
}
catch {

$_.Exception | Format-List * -Force | Out-String | Write-DscTrace -Operation Debug
if ($_.Exception.MessageId -eq 'DscResourceNotFound') {
Write-DscTrace -Operation Warn -Message 'For Windows PowerShell, DSC resources must be installed with scope AllUsers'
}
'Exception: ' + $_.Exception.Message | Write-DscTrace -Operation Error
exit 1
}
Expand Down
Loading