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…