Unable to install packages with DSC configuration- Server 2019

Karthik Shanmugam 1 Reputation point
2020-08-13T11:09:16.157+00:00

Hi Team,

I am trying to install packages using PackageManagement (DSC resource). The below mentioned script works fine in Server 2016 and installs required packages. But in Windows server 2019 I am getting errors like ValidateNodeResources : Resource '[PackageManagementSource]PSGallery' required by
'[PackageManagement]xWebAdministration' does not exist. Please ensure that the required resource exists and the name
is properly formed

Not sure if there is anything blocking on 2019 server which is allowed in 2016 server. Kindly advise.

Script:

Configuration mypackages
{
Import-DscResource -Name PackageManagementSource
Import-DSCResource -Name PackageManagement
node localhost

{

    PackageManagement xWebAdministration
    {
        Ensure               = "Present"
        Name                 = "xWebAdministration"
        Source               = "PSGallery"
        DependsOn            = "[PackageManagementSource]PSGallery"
    }
    PackageManagement xPSDesiredStateConfiguration
    {
        Ensure               = "Present"
        Name                 = "xPSDesiredStateConfiguration"
        Source               = "PSGallery"
        DependsOn            = "[PackageManagementSource]PSGallery"
    }
}

}
$config = mypackages -Verbose
Start-DscConfiguration -Wait -Verbose -force -Path $config.PsParentPath

Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
424 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,446 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Soccan 16 Reputation points
    2020-08-13T12:13:27.08+00:00

    The resource you are depending on, "[PackageManagementSource]PSGallery", where is that coming from, is that from another configuration that should already have been applied? For my eyes it seems that you are depending on a piece of configuration that is not there....