DSC Doesn't restore the configuration

Hi There!
Seems something went wrong with my previous post so that’s why i’m posting it again.

Recently i started the PowerShell: Beginner learning path and got stuck at the DSC part.

I followed the following steps:

Step 1:

configuration Configname {
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
    Node $Computername {
        Windowsfeature IIS{
            Name = 'web-server'
            Ensure = 'Present'
        }
    }
}
$computername = 'serverx'
ConfigName -outputpath c:\DSC\Config

Result:

Directory: C:\DSC\Config


Mode                LastWriteTime         Length Name                                                                                                                                         
----                -------------         ------ ----                                                                                                                                         
-a----       12/05/2017     13:45           1858 serverx.mof

Step 2:

PS C:\Windows\system32> Start-DscConfiguration -Path C:\DSC\Config\ -ComputerName 'serverx' -Verbose -Wait
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsof
t/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer servery with user sid S-1-5-21-1375646641-2800936017-3851355188-4723.
VERBOSE: [serverx]: LCM:  [ Start  Set      ]
VERBOSE: [serverx]: LCM:  [ Start  Resource ]  [[WindowsFeature]IIS]
VERBOSE: [serverx]: LCM:  [ Start  Test     ]  [[WindowsFeature]IIS]
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] The operation 'Get-WindowsFeature' started: web-server
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] The operation 'Get-WindowsFeature' succeeded: Web-Server
VERBOSE: [serverx]: LCM:  [ End    Test     ]  [[WindowsFeature]IIS]  in 1.8520 seconds.
VERBOSE: [serverx]: LCM:  [ Start  Set      ]  [[WindowsFeature]IIS]
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Installation started...
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Continue with installation?
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Prerequisite processing started...
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Prerequisite processing succeeded.
WARNING: [serverx]:                            [[WindowsFeature]IIS] Windows automatic updating is not enabled. To ensure that your newly-installed role or feature is automatically updat
ed, turn on Windows Update.
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Installation succeeded.
VERBOSE: [serverx]:                            [[WindowsFeature]IIS] Successfully installed the feature web-server.
VERBOSE: [serverx]: LCM:  [ End    Set      ]  [[WindowsFeature]IIS]  in 50.0290 seconds.
VERBOSE: [serverx]: LCM:  [ End    Resource ]  [[WindowsFeature]IIS]
VERBOSE: [serverx]: LCM:  [ End    Set      ]
VERBOSE: [serverx]: LCM:  [ End    Set      ]    in  53.1560 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 59.469 seconds

Step 3:

Invoke-Command -ComputerName serverx {Remove-WindowsFeature -Name web-server -Restart}
Success Restart Needed Exit Code      Feature Result                                PSComputerName                                                                                            
------- -------------- ---------      --------------                                --------------                                                                                            
True    Yes            SuccessRest... {Common HTTP Features, Default Document, D... serverx                                                                                            
WARNING: You must restart this server to finish the removal process.

Step 4:

Test-DscConfiguration -CimSession serverx
False

and there lies the problem, even after 15 minutes or longer i still get the “false” and the web-server feature isn’t restored.

Anyone any suggestions on what i’m doing wrong?

How have you configured the LCM on the pull client?

I think i missed that part or it hasn’t been addressed yet :')

You need to configure the LCM.

There is an excellent article on how to do this: https://msdn.microsoft.com/en-us/powershell/dsc/metaconfig

This document is now up to date too! I know that! :slight_smile:

In the LCM configuration, you need to set “ConfigurationMode”.

I’ll read it, thanks for the help!