microsoft / DSCEA

DSC Environment Analyzer (DSCEA) is a simple implementation of PowerShell Desired State Configuration that uses the declarative nature of DSC to scan systems in an environment against a defined reference MOF file and generate compliance reports as to whether systems match the desired configuration.
https://microsoft.github.io/DSCEA
Other
199 stars 41 forks source link

Resources required on nodes for Test-DSCConfiguration #38

Closed anwather closed 7 years ago

anwather commented 7 years ago

When running test-dscconfiguration any resources required by the mof file must be on the remote nodes.

I have written a couple of functions to scan the mof, and copy required resources to the remote nodes before test-dscconfiguration has run.

Can you please review the changes at https://github.com/anwather/DSCEA. There is a new sample config file which needs the xSMBShare resource to be installed on the remote node. Note that the machine which runs Start-DSCEAScan also needs to have the resource as a source.

krjhitch commented 7 years ago

Thanks Anthony! It is unfortunate that currently Test-DSCConfiguration doesn't use the local DSC engine to look up a Resource Module location the way that Start-DSCConfiguration can (and automatically pull down missing resources at MOF integrity checking time).

Your code looks like something that would be a great contribution to the project. Have you tested it yet? One of the issues that we have with code within the scriptblock is that calling functions from our module inside of the scriptblock (i.e. code running within the runspaces) doesn't properly call other module functions. That's why we currently have the Repair-DSCEngine function defined within the script block at the moment.

anwather commented 7 years ago

Hey mate,

Yes tested with a single xResource, whole heap of other things to check I. E. Multiple resources. I do call my Copy-DscResource function while in the runspace and it worked, maybe cause I imported the module beforehand.

If you get a chance clone it and do a quick test but it works for me

Anthony

Get Outlook for Androidhttps://aka.ms/ghei36


From: Keith Hitchcock notifications@github.com Sent: Saturday, March 25, 2017 2:01:04 AM To: Microsoft/DSCEA Cc: Anthony Watherston; Author Subject: Re: [Microsoft/DSCEA] Resources required on nodes for Test-DSCConfiguration (#38)

Thanks Anthony! It is unfortunate that currently Test-DSCConfiguration doesn't use the local DSC engine to look up a Resource Module location the way that Start-DSCConfiguration can (and automatically pull down missing resources at MOF integrity checking time).

Your code looks like something that would be a great contribution to the project. Have you tested it yet? One of the issues that we have with code within the scriptblock is that calling functions from our module inside of the scriptblock (i.e. code running within the runspaces) doesn't properly call other module functions. That's why we currently have the Repair-DSCEngine function defined within the script block at the moment.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/DSCEA/issues/38#issuecomment-289047272, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKwk1j_wU1LATHLMw_VL9l402w5R1dIMks5ro9qwgaJpZM4Mnsri.

krjhitch commented 7 years ago

I just tested it, works great! I had some minor issues with the fact that the Carbon module has a similarly named function to Copy-DSCResource' and I was getting parameter conflicts since that doesn't take a PSsession parameter, but once I cleared that up it worked great.