DSC service check prevents configuration from completing

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Arie H Arie H 8 months, 1 week ago.

  • Author
    Posts
  • #36644
    Profile photo of Christopher Sherrer
    Christopher Sherrer
    Participant

    I have just recently deployed a DSC pull server on Server 2012 R2 with PS 5.0. I am using 2 x Server 2012 R2 test servers with PS 4.0 installed to test configurations. HTTPS pull is configured and everything is running smoothly, except when I add some lines to my configuration file to check for services.

    I have the following code below using some examples from the MVA DSC videos with nested configurations (services (1)) and just straight service checks (2). If I comment out the service checks, everything works great. If I add either method for service checks, the .mof and checksum files are downloaded correctly on each node (verified in C:\Windows\Temp\xxxxx) and I can see where it looks like it should be working. However the LCMState just stays at (Busy) or (PendingConfiguration) for either node and nothing ever happens (no changes made at all from the .mof file). The event logs look okay too. As soon as I comment out the service checks and rebuild the .mof files, it goes back to working great. Any ideas?

    I am still just trying to learn the syntax and principals behind building these .mof files so any pointers would be greatly appreciated!

    # Nested Configuration (1)
    Configuration RunningServices
    {
        param([Parameter()]$Services)
    
        foreach ($Service in $Services) {
            Service $Service
            {
                Name = $Service
                State = "Running"
                Ensure = "Present"
            }
        }
    }
    
    Configuration ServerConfigurations
    {
        Import-DscResource -ModuleName PSDesiredStateConfiguration
    
        Node $AllNodes.NodeName
        {
            #Windows Features ---------------------------------------------------------------
            WindowsFeature SNMP
            {
                Ensure = “Present”
                Name = “SNMP-Service”
            }
            WindowsFeature SNMPWMI
            {
                Ensure = “Present”
                Name = “SNMP-WMI-Provider”
            }
            WindowsFeature TelnetClient
            {
                Ensure = “Present”
                Name = “Telnet-Client”
            }
            WindowsFeature XPS
            {
                Ensure = “Present”
                Name = “XPS-Viewer”
            }
    
            #Services -----------------------------------------------------------------------
    # Simple Service Call - Not Working (2)
            Service SNMPSvc
            {
                Name = "SNMP"
                State = "Running"
                Ensure = "Present"
                DependsOn = "[WindowsFeature]SNMP"  #Tried with and without this line
            }
            Service WINRMSvc
            {
                Name = "WINRM"
                State = "Running"
                Ensure = "Present"
            }
    # Nested Configuration - Not Working (1)
            RunningServices BaseServices
            {
                Services = "WINRM","SNMP"
            }
        }
    
        Node $AllNodes.Where{$_.Role -like "SQLServer"}.NodeName
        {
            WindowsFeature SMTP
            {
                Ensure = “Absent”
                Name = “SMTP-Server”
            }
        }
    
        Node $AllNodes.Where{$_.Role -like "WebServer"}.NodeName
        {
        }
    
        #SNMP Contact Strings --------------------------------------------------------------
        Node $AllNodes.Where{$_.Role -like "Test"}.NodeName
        {
            Registry SNMPString {
                Ensure = "Present"
                Key = "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent"
                ValueName = "sysContact"
                ValueData = "Test Server"
                ValueType = "String"
            }
        }
    }
    
  • #37109
    Profile photo of Christopher Sherrer
    Christopher Sherrer
    Participant

    This looks to be a problem with PS 5.0 DSC servers communicating with PS 4.0 nodes. I upgraded one of my nodes to the latest PS (5.0.10586.117) and reintroduced the service check code into the .mof. On reboot I uninstalled some features, changed the SNMP contact string, and stopped the SNMP service. The node then checked and corrected all of these settings based on the configuration data above.

    So.....we have a ton of PS 4.0 servers and likely will not be allowed to upgrade them to PS 5.0 for some time. I wonder if there a way to fix this without upgrading all of our Windows servers?

  • #37123
    Profile photo of Arie H
    Arie H
    Participant

    Use dsc V4 methods (ConfigurationID and GUIDs) and V4 pull server, would be the logic. Even if you upgrade your servers OS but not the PS on them, the LCM is still compatible with version 1.0 (aka PS v4) and 2.0 (aka PS v5)

    No reason not to upgrade to v5 unless you have a monitoring or similar software that is incompatible, but even then it will mist likely he upgraded by their creators.

    Do note in the ps v5 docs that there are currently certain scenarios where you shouldn't upgrade to v5, like on an exchange machine iirc.

You must be logged in to reply to this topic.