Troubleshooting Modules/Resources

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Justin King Justin King 2 years ago.

  • Author
    Posts
  • #20584
    Profile photo of Justin King
    Justin King
    Participant

    So I wrote myself a cool module that works fantastically in my lab and I decided to pocket it to use for client to help hydrate some new installations and speed things up only to have it completely error out and not work.

    Well that's no fun. Thankfully my modules are rather rich in verbosity so I even know where they failed but the thing I don't get is ... why. Running them manually works perfectly. using psexec to launch powershell in the system context even works perfectly (I assume it runs under the system context)... yet when I start-dscconfiguration and "make it so" it fails gloriously. So obviously my modules are not accounting for _something_ .... but I have no idea what (again they work in my lab ... so there's something unique to the client servers and I'd rather figure it out so the module gets more robust).

    So how do you guys troubleshoot things when they simply don't work? Is there some kind of tool that can be run to look at the running process directly and try to figure out what it can and can't see? Is there a command that can be used to execute code in the same context of DSC (if it's not in the system context?) with -verbose and well placed entries I know exactly what line my code is failing at ... but I can't figure out why as it runs perfect in the system and current user contexts...

  • #20588
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    DSC runs as LocalSystem. Beyond that, you're doing everything right; enable the Analytic and Debug logs to see your Write-Verbose and Write-Debug output.

    At this point, general questions are out the window, and we'd need to see what you've already figured out: what statements are not behaving the way you think they should, and what are the actual results? Error messages? etc.

  • #20589
    Profile photo of Justin King
    Justin King
    Participant

    Well in this case the culprit ended up being my old nemesis: GPOs and Execution Policy. It happened to be set so tight even some Microsoft modules refused to import which in turn made some of my modules run incorrectly.

    The question was more inline with "so how do you guys troubleshoot" like if there was some buried log file somewhere I didn't know about 🙂 Thanks for confirming I'm going in the right direction.

You must be logged in to reply to this topic.