PSDesiredStateConfiguration
PSDesiredStateConfiguration copied to clipboard
Invoke-DscResource doesn't display any stream output from the dsc resource
Steps to reproduce
Invoke a dsc resource that contains any stream ouput (ex. Verbose). Below is a simple example only to demonstrate verbose output.
StreamTest.psm1
[DscResource()]
class MyTestResource
{
[DscProperty(Key)]
[string] $SomeVal
[void] Set() {
Write-Verbose "Entered Set method"
}
[MyTestResource] Get() {
Write-Verbose "Entered Get method"
return $this
}
[bool] Test() {
Write-Verbose "Entered Test method"
return $true
}
}
StreamTest.psd1
@{
# Script module or binary module file associated with this manifest.
RootModule = 'StreamTest.psm1'
DscResourcesToExport = @(
'MyTestResource'
)
# Version number of this module.
ModuleVersion = '1.0.0.0'
# ID used to uniquely identify this module
GUID = '6c583f5e-3712-432d-a65c-29f665a7a07a'
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.0'
}
Invoking the dsc resource
$splat = @{
Name = 'MyTestResource'
ModuleName = 'StreamTest'
Method = 'Test'
Property = @{
SomeVal = 'Test'
}
Verbose = $true
}
Invoke-DscResource @splat
Expected behavior
Should display verbose output from the dsc resource.
Actual behavior
Does not display verbose output from the dsc resource.
Environment data
Name | Value |
---|---|
PSVersion | 7.1.0 |
PSEdition | Core |
GitCommitId | 7.1.0 |
OS | Microsoft Windows 10.0.18363 |
Platform | Win32NT |
PSCompatibleVersions | {1.0, 2.0, 3.0, 4.0…} |
PSRemotingProtocolVersion | 2.3 |
SerializationVersion | 1.1.0.1 |
WSManStackVersion | 3.0 |
I concur, this is annoying :) also tested on 7.1.3 fwiw.
I should test this again but I think it was fixed in 7.3, or somewhere in 7.2 by Andrew...