I applied a DSC Configuration and it was successful applied through both the commands, either by using
start-dscconfiguration -wait -force -path <Path of the folder containing MOF file>
or
$paramforSendConfigurationApplyMethod = @{
ConfigurationData = $dataInUint8Format
force = $True
}
Invoke-CimMethod -CimClass $cimClass -CimSession $wsmanSession -MethodName SendConfigurationApply -Arguments $paramforSendConfigurationApplyMethod -Verbose
When I tried to test the configuration , with the below command
Test-DscConfiguration -ReferenceConfiguration <Path of localhost.mof> , the output I got is
InDesiredState : True
ResourcesInDesiredState : {[RegistryPolicyFile]Registry(POL):
HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Ext\RunThisTimeEnabled,
[RefreshRegistryPolicy]ActivateClientSideExtension}
ResourcesNotInDesiredState :
ReturnValue : 0
PSComputerName : Localhost
However, when I tried to execute the Test configuration with the CIM method
$paramforTestConfiguration = @{
ConfigurationData = $dataInUint8Format
}
invoke-CimMethod -CimClass $cimClass -CimSession $wsmanSession -MethodName TestConfiguration -Arguments $paramforTestConfiguration | format-list
, I got the results as null
InDesiredState : False
ResourcesInDesiredState :
ResourcesNotInDesiredState :
ReturnValue : 0
PSComputerName : localhost
I am not sure why for the same DSC configuration, both "Test" commands are displaying different output.i.e., one output says
that the DSC is in Desired state but the other is not.
I am testing this in the local stand alone development windows computer (ws2016)