Closed Rokory closed 1 year ago
Just tested this and I didn't appear to have an issue. It's only a simple configuration, but it is applied successfully. I'll push the updated 0.22.0 module version and you can try again with the new media (it might be something with your custom media registration)?
Issue407.psd1
@{
AllNodes = @(
@{
NodeName = 'WIN11-22H2'
Lability_Media = 'WIN11_x64_Enterprise_22H2_EN_Eval'
}
)
NonNodeData = @{
Lability = @{ }
}
}
WIN11-22H2.mof
/*
@TargetNode='WIN11-22H2'
@GeneratedBy=Administrator
@GenerationDate=09/27/2022 16:07:21
@GenerationHost=WIN11-DSC
*/
instance of MSFT_RegistryResource as $MSFT_RegistryResource1ref
{
ResourceID = "[Registry]RegistryTesting";
ValueName = "Lability";
Key = "HKEY_LOCAL_MACHINE\\SOFTWARE";
Ensure = "Present";
SourceInfo = "::7::9::Registry";
ModuleName = "PsDesiredStateConfiguration";
ValueData = {
"Test"
};
ModuleVersion = "1.0";
ConfigurationName = "Issue407";
};
instance of OMI_ConfigurationDocument
{
Version="2.0.0";
MinimumCompatibleVersion = "1.0.0";
CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"};
Author="Administrator";
GenerationDate="09/27/2022 16:07:21";
GenerationHost="WIN11-DSC";
Name="Issue407";
};
PS D:\Scratch\Lability_Issue407> Start-LabConfiguration -ConfigurationData .\Issue407.psd1 -Path .\ -NoSnapshot -Verbose -IgnorePendingReboot
VERBOSE: [16:17:20] Started Lab host configuration test.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\Configurations' exists.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\VMDisks' exists.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\Hotfixes' exists.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\ISOs' exists.
VERBOSE: [16:17:20] Testing directory 'C:\ProgramData\Lability\Modules' exists.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\ParentDisks' exists.
VERBOSE: [16:17:20] Testing directory 'D:\Lability\Resources' exists.
VERBOSE: [16:17:20] Testing node 'Hyper-V role' configuration.
VERBOSE: [16:17:21] Testing node 'Pending reboot' configuration.
VERBOSE: [16:17:21] Testing 'Test-PendingRebootTargetResource' failed.
WARNING: [16:17:21] A pending reboot is required. Please reboot the system and re-run the configuration.
VERBOSE: [16:17:21] Finished Lab host configuration test.
VERBOSE: [16:17:21] Started Lab configuration.
VERBOSE: [16:17:21] Searching configuration paths.
VERBOSE: [16:17:21] Checking node configuration file 'D:\Scratch\Lability_Issue407\WIN11-22H2.mof'.
VERBOSE: [16:17:21] Checking node configuration file 'D:\Scratch\Lability_Issue407\WIN11-22H2.meta.mof'.
WARNING: [16:17:21] Cannot locate LCM configuration file 'D:\Scratch\Lability_Issue407\WIN11-22H2.meta.mof'. No DSC Local Configuration Manager configuration will be applied.
VERBOSE: [16:17:21] Started Lab configuration test.
VERBOSE: [16:17:21] Testing node 'WIN11-22H2' configuration.
VERBOSE: [16:17:21] Testing Image configuration 'WIN11_x64_Enterprise_22H2_EN_Eval'.
VERBOSE: [16:17:21] Testing Virtual Switch configuration 'Default Switch'.
VERBOSE: [16:17:21] Testing VHDX configuration 'WIN11_x64_Enterprise_22H2_EN_Eval'.
VERBOSE: [16:17:22] Testing 'Test-VHDTargetResource' failed.
VERBOSE: [16:17:22] Finished Lab configuration test.
VERBOSE: [16:17:22] Node 'WIN11-22H2' is missing or misconfigured.
VERBOSE: [16:17:22] Creating VM 'WIN11-22H2'.
VERBOSE: [16:17:22] Setting Virtual Switch configuration 'Default Switch'.
WARNING: [16:17:22] Using existing 'Default Switch' virtual switch.
VERBOSE: [16:17:22] (Re)setting VHDX configuration 'WIN11-22H2.vhdx'.
VERBOSE: [16:17:23] Testing 'Test-VHDTargetResource' failed.
VERBOSE: [16:17:24] Setting VM configuration 'WIN11-22H2'.
VERBOSE: [16:17:24] Creating Gen 2 virtual machine.
VERBOSE: [16:17:24] Testing 'Test-VMTargetResource' failed.
VERBOSE: [16:17:26] Adding VM customizations.
VERBOSE: [16:17:27] Mounting disk image 'D:\Lability\VMDisks\WIN11-22H2.vhdx'.
VERBOSE: [16:17:27] Adding VM resources.
VERBOSE: [16:17:27] Adding BootStrap.ps1 file to 'E:\BootStrap'.
VERBOSE: [16:17:27] Creating directory 'E:\BootStrap'.
VERBOSE: [16:17:27] Adding SetupComplete.cmd to 'E:\Windows\Setup\Scripts'.
VERBOSE: [16:17:28] Creating directory 'E:\Windows\Setup\Scripts'.
VERBOSE: [16:17:28] Using default 'SetupComplete.cmd'.
VERBOSE: [16:17:28] Setting local administrator password.
VERBOSE: [16:17:28] Adding Unattend file 'E:\Windows\System32\Sysprep\Unattend.xml'.
VERBOSE: [16:17:28] Adding DSC file 'E:\BootStrap\localhost.mof'.
VERBOSE: [16:17:28] Adding Client certificate 'E:\BootStrap\LabClient.pfx'.
VERBOSE: [16:17:28] Adding Root certificate 'E:\BootStrap\LabRoot.cer'.
WARNING: [16:17:28] No DSC resources have been defined. Locally registered DSC resources will be copied, but this is deprecated functionality. Please update the Lability configuration document with required DSC resource definitions.
VERBOSE: [16:17:28] Processing DSC node configuration file 'D:\Scratch\Lability_Issue407\WIN11-22H2.mof'.
VERBOSE: [16:17:28] Adding DSC resource modules to 'E:\Program Files\WindowsPowershell\Modules'.
VERBOSE: [16:17:28] Copying module directory '1.0.0.1' to 'E:\Program Files\WindowsPowershell\Modules\PackageManagement'.
VERBOSE: [16:17:28] Dismounting disk image 'D:\Lability\VMDisks\WIN11-22H2.vhdx'.
VERBOSE: [16:17:28] Finished Lab configuration.
PS D:\Scratch\Lability_Issue407>
Here's the Bootstrap-20220927-042016.log file and the excerpt of the DSC configuration applying within the VM:
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN11-22H2 with user sid S-1-5-18.
VERBOSE: [WIN11-22H2]: LCM: [ Start Set ]
VERBOSE: [WIN11-22H2]: LCM: [ Start Resource ] [[Registry]RegistryTesting]
VERBOSE: [WIN11-22H2]: LCM: [ Start Test ] [[Registry]RegistryTesting]
VERBOSE: [WIN11-22H2]: [[Registry]RegistryTesting] Registry key value 'HKLM:\SOFTWARE\Lability' does not exist
VERBOSE: [WIN11-22H2]: LCM: [ End Test ] [[Registry]RegistryTesting] in 0.9270 seconds.
VERBOSE: [WIN11-22H2]: LCM: [ Start Set ] [[Registry]RegistryTesting]
VERBOSE: [WIN11-22H2]: [[Registry]RegistryTesting] (SET) Set registry key value 'HKLM:\SOFTWARE\Lability' to 'Test' of type 'String'
VERBOSE: [WIN11-22H2]: LCM: [ End Set ] [[Registry]RegistryTesting] in 0.1250 seconds.
VERBOSE: [WIN11-22H2]: LCM: [ End Resource ] [[Registry]RegistryTesting]
VERBOSE: [WIN11-22H2]: LCM: [ End Set ]
VERBOSE: [WIN11-22H2]: LCM: [ End Set ] in 4.3580 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 4.609 seconds```
Version 0.22.0 has been published to the PowerShell Gallery if you can try that?
I tried it again today. Seemed to work okay.
I registered the new Windows 11 22H2 evaluation Enterprise ISO image. Trying to configure a machine with that image fails on the DSC configuration. The same configuration with 21H2 works perfectly. Excerpt from the bootstrap log:
Windows PowerShell transcript start Start time: 20220926112239 Username: WORKGROUP\SYSTEM RunAs User: WORKGROUP\SYSTEM Configuration Name: Machine: CL1 (Microsoft Windows NT 10.0.22621.0) Host Application: Powershell.exe -NoProfile -ExecutionPolicy Bypass -NonInteractive -File C:\BootStrap\BootStrap.ps1 Process ID: 3124 PSVersion: 5.1.22621.169 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.22621.169 BuildVersion: 10.0.22621.169 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1
Transcript started, output file is C:\BootStrap\Bootstrap-20220926-112238.log Root "Trusted Root Certification Authorities" Signature matches Public Key Certificate "Virtual Engine Test Lab Root Authority" added to store. CertUtil: -addstore command completed successfully. Enter PFX password: Certificate "Lability Dsc Signing Certificate" added to store.
CertUtil: -importPFX command completed successfully. my "Personal" Deleting Certificate 0: CN=DscEncryptionCert:ea535ba6b18d99639ad2d5102d306a7567789f7c CertUtil: -delstore command completed successfully. Enter PFX password: Certificate "Lability Dsc Signing Certificate" added to store.
CertUtil: -importPFX command completed successfully. VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Client Property: maxEnvelopeSize". VERBOSE: Performing the operation "New Item" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff". VERBOSE: Performing the operation "Start-DscConfiguration: SendMetaConfigurationApply" on target "MSFT_DSCLocalConfigurationManager". VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendMetaConfigurationApply,'className' = MSFT_DSCLocalConfig Bootstrap-20220926-112238.log urationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".