Author Posts

April 25, 2017 at 2:12 pm

Hi,
I've setup my test HTTPS Pull Server and trying to configure test client. When I run get-dscconfiguration on the client I get error:

PS C:\Windows\system32> Get-DscConfiguration -CimSession test-windows10
Get-DscConfiguration : The PowerShell DSC resource MSFT_xRemoteFile from module xPSDesiredStateConfiguration,6.2.0.0 does not exist at the PowerShell 
module path nor is it registered as a WMI DSC resource.
At line:1 char:1
+ Get-DscConfiguration -CimSession test-windows10

I have zipped the module with Publish-DSCModuleAndMof cmdled, so everything seems fine on pull server, hoever it seems that client is not downloading the module it needs and I can't identify the reason.

My pull server config:

configuration CreateHTTPSPullServer
{
    param
    (
        [string[]]$ComputerName = 'localhost',
        
        [ValidateNotNullOrEmpty()]
        [string]$CertificateThumbPrint,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]$Registrationkey
    )
    
    Import-DscResource -ModuleName xPSDesiredStateConfiguration
    Import-DscResource -ModuleName PSDesiredStateConfiguration

    Node $ComputerName
    {
        WindowsFeature DSCServiceFeature
        {
            Ensure ='Present'
            Name = 'DSC-Service' 
        }

        WindowsFeature IISConsole
        {
            Ensure = 'Present'
            Name = 'Web-Mgmt-Console'
        }

        xDscWebService PSDSCPullServer
        {
            Ensure = 'Present'
            EndpointName = 'PSDSCPullServer'
            Port = 8080
            PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
            CertificateThumbPrint = $CertificateThumbprint
            State = 'Started'
            ModulePath = "$env:ProgramFiles\WindowsPowerShell\DscService\Modules"
            ConfigurationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration"
            RegistrationKeyPath = "$env:ProgramFiles\WindowsPowerShell\DscService"
            AcceptSelfSignedCertificates = $false
            UseSecurityBestPractices = $true
            DependsOn = '[WindowsFeature]DSCServiceFeature'
        }

        File RegistrationKeyFile
        {
            Ensure = 'Present'
            Type = 'File'
            DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
            Contents = $Registrationkey
        }
    }
}

$CertificateThumbPrint = (Get-ChildItem Cert:\LocalMachine\My).Where{$_.FriendlyName -eq "DSCPullServer"}.Thumbprint

#Generate MOF
CreateHTTPSPullServer -OutputPath C:\DSCSTUFF\Configs\PullServer -ComputerName $env:COMPUTERNAME -CertificateThumbPrint $CertificateThumbPrint -Registrationkey xxx-xxx

If I copy the module manually to the client, it applies the configuration successfully.

April 25, 2017 at 2:17 pm

The error is telling you the client doesn't HAVE the module. What's the client's LCM configuration look like? Have you created a checksum file for the ZIP, on the pull server?

April 25, 2017 at 6:40 pm

Shouldn't it be downloading the missing module from Pull server if I have it ModuleName_ModuleVersion.zip in $env:ProgramFiles\WindowsPowerShell\DscService\Modules

a checksum was created automatically when using Publish-DSCModuleAndMof:

$ModuleList = @(
"xPSDesiredStateConfiguration"
)
$MofSource = "C:\DSCSTUFF\Configs\TargetNodes"
Publish-DSCModuleAndMof -ModuleNameList $ModuleList -Source $MofSource

client LCM config:

[DscLocalConfigurationManager()]
configuration LCMMetaConfig
{
    param
    (
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()][string[]]
        $ComputerName,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()][string[]]
        $ConfigurationName
    )

    Node $ComputerName
    {
        Settings
        {
            RefreshMode = 'Pull'
            ConfigurationMode = 'ApplyAndAutoCorrect'
            RebootNodeIfNeeded = $false
            RefreshFrequencyMins = 30
            ConfigurationModeFrequencyMins = 15
            DebugMode = 'All'

        }

        ConfigurationRepositoryWeb PullServerConfig
        {
            ServerURL = 'https://PullServer.domain.pri:8080/PSDSCPullServer.svc'
            RegistrationKey = 'xxxxx-xxx...'
            ConfigurationNames = $ConfigurationName
        }

        ReportServerWeb ReportServerConfig
        {
            ServerURL = 'https://PullServer.domain.pri:8080/PSDSCPullServer.svc'
        }
    }
}
$ComputerName = @("test-windows10")
$ConfigurationName = @("ClientConfig")

# Create meta.mof files
LCMMetaConfig -OutputPath C:\DSCSTUFF\Configs\TargetNodes -ComputerName $ComputerName -ConfigurationName $ConfigurationName

# Send to computers LCM
Set-DscLocalConfigurationManager -Path C:\DSCSTUFF\Configs\TargetNodes -Verbose

client meta.mof:

instance of MSFT_WebDownloadManager as $Alias00000000
{
    ResourceId = "[ConfigurationRepositoryWeb]PullServerConfig";
    SourceInfo = "C:\\DSCSTUFF\\Scripts\\LCMMetadata.ps1::28::9::ConfigurationRepositoryWeb";
    ServerURL = "https://PullServer.domain.pri:8080/PSDSCPullServer.svc";
    RegistrationKey = "";
    ConfigurationNames = {"ClientConfig"};
};

instance of MSFT_WebReportManager as $Alias00000001
{
    ResourceId = "[ReportServerWeb]ReportServerConfig";
    SourceInfo = "C:\\DSCSTUFF\\Scripts\\LCMMetadata.ps1::35::9::ReportServerWeb";
    ServerURL = "https://PullServer.domain.pri:8080/PSDSCPullServer.svc";
    RegistrationKey = "";
};

instance of MSFT_DSCMetaConfiguration
{
    ConfigurationModeFrequencyMins = 15;
    RebootNodeIfNeeded = False;
    ConfigurationMode = "ApplyAndAutoCorrect";
    ActionAfterReboot = "ContinueConfiguration";
    RefreshMode = "Pull";
    RefreshFrequencyMins = 30;
    AllowModuleOverwrite = False;
    DebugMode = {"All"};
    LCMVersion = "2.0";
    LCMCompatibleVersions = {"1.0", "2.0"};
    LCMState = "Busy";
    ConfigurationDownloadManagers = {$Alias00000000};
    ResourceModuleManagers = {};
    ReportManagers = {$Alias00000001};
    StatusRetentionTimeInDays = 10;
    AgentId = "120CF76A-2865-11E7-ACC0-00155D063E0F";
    SignatureValidationPolicy = "NONE";
    SignatureValidations = {};
    MaximumDownloadSizeMB = 500;
};

instance of OMI_ConfigurationDocument
{
    Version = "2.0.0";
    Author = "aurimas";
    GenerationDate = "04/25/2017 21:23:16";
    GenerationHost = PullServer";
    Name = "LCMMetaConfig";
    MinimumCompatibleVersion = "2.0.0";
    CompatibleVersionAdditionalProperties = {"MSFT_DSCMetaConfiguration:StatusRetentionTimeInDays"};
};

April 25, 2017 at 6:45 pm

Your LCM doesn't know where to pull from. You've configured a configuration (MOF) repository, but not a resource (ZIP) repository. You need a ResourceRepositoryWeb section.

April 26, 2017 at 8:06 am

Oh I'm bad at reading documentation, also all that outdated info on the internet regarding dsc is confusing..
My first node is getting configuration fine now, thanks!