Can't Stop Warning even after adding Import-Module

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 8 months, 3 weeks ago.

  • Author
    Posts
  • #36813
    Profile photo of i255d
    i255d
    Member

    I am doing what the warning suggests, but I still get the warning.

    Any idea how I can get this to stop?

    I did add the xPSDesiredStateConfiguration instead of the PSDesiredStateConfiguration, I thought I would want the newest code to work with the configuration, but it seems I am missing something.

    PS C:\> Configuration SimpleDSC
    {
            param ( $NodeName )
            Import-DscResource –ModuleName 'xPSDesiredStateConfiguration'
            Node $NodeName
            {
                WindowsFeature WebBackup
                    {
                        Ensure = "Present"
                        Name = "Windows-Server-Backup"
    		}
    	}
    }
    
    $nDir = mkdir C:\DSC\SimpleConfig\$Computer -Force
    
    SimpleDSC -OutputPath $nDir.FullName -NodeName $Computer -Verbose
    WARNING: The configuration 'SimpleDSC' 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.
    
    
        Directory: C:\DSC\SimpleConfig\cho3w9wb24
    
    
    Mode                LastWriteTime         Length Name                                                                                                              
    ----                -------------         ------ ----                                                                                                              
    -a----        3/22/2016   2:23 AM           1898 cho3w9wb24.mof < \pre>
  • #36815
    Profile photo of Arie H
    Arie H
    Participant

    Usualy this means there's something wrong with your $env:PSMosulePath.

    Nothing in your script requires xPSDesiredStateConfiguration, so no need to add it.

  • #36836
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    The warning says you should import PSDesiredStateConfiguration, not xPSDesiredStateConfiguration. 🙂 No "x".

You must be logged in to reply to this topic.