VirtualEngine / Lability

Virtual Engine test lab deployment and configuration module
MIT License
282 stars 50 forks source link

Remove Dependency on Dsc Resources from the PSDesiredStateConfiguration Version 1.1 Module #395

Closed valainisgt closed 1 year ago

valainisgt commented 2 years ago

I am raising this issue as I'd like to be able to run Lability from Powershell 7.2. Based on my own experimentation the dependency on the PSDesiredStateConfiguration Version 1.1 module seems to be an issue. When running the command Test-LabHostConfiguration I get the following output:

VERBOSE: [2:26:32 PM] Started Lab host configuration test.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\Configuration' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\DifferencingVhd' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\Hotfix' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\Iso' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\ProgramData\Lability\Modules' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\ParentVhd' exists.
VERBOSE: [2:26:32 PM] Testing directory 'C:\Lability\Resources' exists.
VERBOSE: [2:26:32 PM] Importing DSC Resource 'PSDesiredStateConfiguration\MSFT_WindowsOptionalFeature'.
Get-LabDscModule:
Line |
  38 |  … ourcePath = Get-LabDscModule -ModuleName $ModuleName -ResourceName $R …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Path' because it is null.
VERBOSE: [2:26:32 PM] Testing node 'Hyper-V role' configuration.
WARNING: [2:26:32 PM] DSC resource 'Test-WindowsOptionalFeatureTargetResource' failed with errror 'The term 'Test-WindowsOptionalFeatureTargetResource' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'.
VERBOSE: [2:26:32 PM] Testing 'Test-WindowsOptionalFeatureTargetResource' failed.
False

It appears that the only Dsc resources being used from the PSDesiredStateConfigurationModule Version 1.1 are the MSFT_WindowsOptionalFeature and the MSFT_RoleResource. These should be able to be replaced with the WindowsOptionalFeature and WindowsFeature Dsc resources from the PSDscResources module.

I have only done a limited amount of investigation into the repercussions of making a change like this but some initial testing allowed me to get a lab up and running with Powershell 7.2.

valainisgt commented 2 years ago

So the PSDscResourcesModule is only compatible with WMF 5.1. However, xPSDesiredStateConfiguration appears to be compatible with WMF 4 and WMF 5.

valainisgt commented 1 year ago

Resolved with PR #396