Author Posts

November 11, 2014 at 10:45 am

Wondering if folks can direct me to the correct way to to do this. Currently I'm working on a custom DSC resource for installing SQL Server and I am trying to write troubleshooting messages to the DSC Windows log (ideally the Operational log, but I figure Analytic or Debug would work the same way). I'm not finding any good web hits on how to do this and it feels like I'm missing something obvious. Can anyone direct me to a "how to" or similar guidance for this?


November 11, 2014 at 10:47 am

You can use Write-Verbose and Write-Debug in your DSC resource code, and DSC will take care of the rest. If I remember correctly, Verbose output goes into the Operational log, and Write-Debug goes into the Debug log, but don't quote me on that. 🙂 I don't have a system up where I can quickly double check that at the moment.

Edit: Looks like I might have been wrong about where Write-Verbose goes. mentions that Verbose output goes to the Analytic log, not Operational.

November 11, 2014 at 10:54 am

Odd that, because I'm using Write-Verbose, but the information doesn't seem to be hitting the Operational Log. I can revisit it, make sure I'm doing what I think I'm doing. And, just to make sure I'm on the correct track, will it post an error to those logs if I use Write-Error?

November 11, 2014 at 10:55 am

Check out the link I just posted in the edit to my last reply. According to that, Verbose output goes to the Analytic log, and Errors go to the Operational log. (Write-Debug, I assume, goes to the Debug log.)

November 11, 2014 at 11:01 am

Thanks Dave, much appreciated. Not super concerned about which log the output goes to, just that it goes somewhere.