Import-DscResource Warning Message in WMF 5.0 April 2015 Preview

Import-DscResource: Warning Message

The latest version of the Microsoft Windows Management Framework (WMF) Core 5.0 package has some improvements to the PowerShell and Desired State Configuration (DSC) experience.

One of those improvements is a warning message that will appear, if you do not use the Import-DscResource dynamic keyword to import the PSDesiredStateConfiguration module. The warning message appears when you execute the DSC Configuration Document by name, not when you simply define it.

WARNING: The configuration ‘Contoso’ is loading one or more built-in resources without explicitly importing associated modules. Add Import-DscResource –ModuleName ’PSDesiredStateConfiguration’ to your configuration to avoid this message.

If you see that message, you can safely ignore it (for now), or you can simply add the following line to your PowerShell DSC Configuration Documents.

Import-DscResource -ModuleName PSDesiredStateConfiguration;

The resulting DSC Configuration Document would look like:

configuration Contoso {
    param (
    )
    Import-DscResource -ModuleName PSDesiredStateConfiguration;

    File WindowsUpdateLog {
        DestinationPath = 'c:windowswindowsupdate.log';
        Ensure = 'Present';
    }
}

DSC Configuration Document