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
197 stars 41 forks source link

New Powershell Check Version #57

Open ThierryBT opened 7 years ago

ThierryBT commented 7 years ago

Hi Raplh and Keith and sorry for my Funny English. During my test, I have a little problem with powershell version. Not all powershell 5 versions are compatible with DSCEA. For example, the 5.0.10018.0 version does not accept the "Test-DscConfiguration-ReferenceConfiguration". And DSCEA does not work (All configurations are False). I could not test the next BUILD (5.0.10586.51) but it's Ok with the 5.0.10586.117 version. During my tests, I used the same Framework version (4.0.30319.42000).

I have modify the Start-DSCEAscan functions. I replaced line 279 and 280 by : $runlist = ($psjobresults | Where-Object {$.Major -ge 5 -and $.Build -gt 10018}).PSComputername $versionerrorlist = ($psjobresults | Where-Object {($.Major -lt 5) -or ($.Major -ge 5 -and $_.Build -le 10018)}).PSComputername And the line 292 Write-Warning "The following systems cannot be scanned as they are not running the good Powershell Version (Greater Than 5.0.10018). Please check '$versionerrorlist' for details" dscea All it's Ok for my environment. If you think this is a good solution, I let you use with pleasure ;)

Regards Thierry

rkyttle commented 7 years ago

Hi Thierry,

We currently check to ensure that systems are running at least PowerShell 5 because that is required to use Test-DscConfiguration -ReferenceConfiguration, but we aren't currently checking to ensure that the version of PowerShell is RTM or later.

$versionerrorlist = ($psjobresults | where-object -Property Major -lt 5).PSComputername

We'll discuss an update to this, as we need to ensure that systems aren't just at a version of 5 or higher, but that they are at least running the RTM release, version 5.0.10586.117

In your case, I assume your systems still have a preview version of WMF 5 installed and were never upgraded to the RTM release. This is something we can and should be checking for.

Thank you for bringing this up!