Author Posts

September 4, 2018 at 2:20 pm

Can someone please help me with the following question

I notice the reporting in DSC is very limited, to get around this I know I can use the 'script' resource to write my own code and within this code write information to the Windows event log etc as I go to provide as much or as little additional information as I require. For example I could use the 'script' resource and write a simple WMI query a windows service and is current status etc then write the information to the windows event log for later reporting etc.

rather than writing more code, I wondered if I could take a shortcut by using an existing resource (that does not give much information, except compliant or not compliant) capturing the information it returns (assuming it returns something) then use this captured information like so

configuration MyConfig {

Node LocalHost {

Registry IPv4Info {

Key = 'HKLM:SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters'
ValueName = 'Dhcpv6DUID'
Ensure = 'Present'

}

$Result = IPv4Info
Write-EventLog -LogName Application -Source MyDSC -EntryType Information -EventId 12 -Message "Result of registry check was $($Result | out-string)"

}

}

it that possible ? or does these resources generally not return any information (as this is dealt with internal to the resource) ? or would I in effect be running the resource twice (once by the system and again when I call it) and still get no more information ?

Thank you in advance

CXMelga

 

 

September 4, 2018 at 5:19 pm

That's where Get-DSCConfigurationStatus is used.

I would request you to go through the documentations on DSC.

https://docs.microsoft.com/en-us/powershell/dsc/gettingstarted

In addition to this, You can check the DSCEA module for passive html reports.