Author Posts

May 11, 2018 at 10:53 pm

I am having an issue enrolling my nodes in Azure DSC the nodes enroll ok but that's it I can't pull the config and trying to run Update-DSCConfiguration results in the error below. I found a post somewhere saying Deleting C:\Windows\System32\Configuration\DSCEngineCache.mof could possibly resolve the issue but I am not having any luck.

The nodes were previously connected to an on prem pull server as well as most recently configured with some Push configs. all of them are powershell 5.0. Any help troubleshooting this would be appreciated.

Update-DscConfiguration -Wait -Verbose
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = PerformRequiredConfigurationChecks,'className' = MSFT_DSCLocalConfigurationManage
r,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer  with user sid ,
The specified Property does not exist.
    + CategoryInfo          : MetadataError: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 12
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.096 seconds

Here is the Script I am using to register the nodes with:

Param(
    [String]$ServerURL = "",
    [String]$AzureKey = "",
    [Switch]$Force = $true
)

[DscLocalConfigurationManager()]
Configuration DscMetaConfigs
{

    param
    (
        [Parameter(Mandatory = $True)]
        [String]$RegistrationUrl,

        [Parameter(Mandatory = $True)]
        [String]$RegistrationKey,

        [Parameter(Mandatory = $True)]
        [String[]]$ComputerName,

        [Int]$RefreshFrequencyMins = 1440,

        [Int]$ConfigurationModeFrequencyMins = 1440,

        [String]$ConfigurationMode = "ApplyAndMonitor",

        [String]$NodeConfigurationName,

        [Boolean]$RebootNodeIfNeeded = $False,

        [String]$ActionAfterReboot = "ContinueConfiguration",

        [Boolean]$AllowModuleOverwrite = $true,

        [Boolean]$ReportOnly
    )

    if (!$NodeConfigurationName -or $NodeConfigurationName -eq "") {
        $ConfigurationNames = $null
    }
    else {
        $ConfigurationNames = @($NodeConfigurationName)
    }

    if ($ReportOnly) {
        $RefreshMode = "PUSH"
    }
    else {
        $RefreshMode = "PULL"
    }

    Node $ComputerName
    {

        Settings {
            RefreshFrequencyMins           = $RefreshFrequencyMins
            RefreshMode                    = $RefreshMode
            ConfigurationMode              = $ConfigurationMode
            AllowModuleOverwrite           = $AllowModuleOverwrite
            RebootNodeIfNeeded             = $RebootNodeIfNeeded
            ActionAfterReboot              = $ActionAfterReboot
            ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins
        }

        if (!$ReportOnly) {
            ConfigurationRepositoryWeb AzureAutomationDSC {
                ServerUrl          = $RegistrationUrl
                RegistrationKey    = $RegistrationKey
                ConfigurationNames = $ConfigurationNames
            }

            ResourceRepositoryWeb AzureAutomationDSC {
                ServerUrl       = $RegistrationUrl
                RegistrationKey = $RegistrationKey
            }
        }

        ReportServerWeb AzureAutomationDSC {
            ServerUrl       = $RegistrationUrl
            RegistrationKey = $RegistrationKey
        }
    }
}

# Create the metaconfigurations
# TODO: edit the below as needed for your use case
$Params = @{
    RegistrationUrl                = $ServerURL;
    RegistrationKey                = $AzureKey ;
    ComputerName                   = @("$env:Computername");
    NodeConfigurationName          = 'registerdsc.localhost';
    RefreshFrequencyMins           = 1440;
    ConfigurationModeFrequencyMins = 1440;
    RebootNodeIfNeeded             = $false;
    AllowModuleOverwrite           = $True;
    ConfigurationMode              = 'ApplyAndMonitor';
    ActionAfterReboot              = 'ContinueConfiguration';
    ReportOnly                     = $False; # Set to $True to have machines only report to AA DSC but not pull from it
}

$currentserverurl = (Get-DscLocalConfigurationManager).ConfigurationDownloadManagers.ServerUrl

If (!($currentserverurl -eq $ServerURL) -or $Force) {
    Write-Verbose "Configuring LCM to $ServerURL"
    Write-Verbose "Starting Azure DSC Config"
    DscMetaConfigs @Params -OutputPath C:\source\DSC
    Set-DscLocalConfigurationManager -ComputerName $env:computername -Path C:\Source\DSC -Force -Verbose -ErrorAction Continue

    Write-Host "Configuration Complete Trying to update:"
    Start-Sleep 60
    Update-DscConfiguration -ErrorAction SilentlyContinue -Wait
    Write-Host "Configuration Succesfull"
}
else {
    Write-Verbose "Server URL is already set correctly."
}

May 14, 2018 at 8:10 pm

Hi Mark. This is a known issue in PowerShell 5.0 that is fixed in 5.1. Is it possible to upgrade the node?
https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure

If that is not possible then another option is to delete the DSCEngineCache.mof from C:\Windows\System32\Configuration. Before deleting, however, please stop the DSC WMI provider process. This process ID can be found by running the following command:
> tasklist /m dsccore.dll

Once this process is stopped, then delete the DSCEngineCache.mof file and try running any DSC command and the issue should be resolved.

Thanks!
Michael Greene
Microsoft Desired State Configuration