InDesiredState True even if the node is not so

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Steve Groner Steve Groner 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #51445
    Profile photo of Soma sympli
    Soma sympli
    Participant

    I created my first DSC Pull server, which installed IIS as required in the managed node vms02, I later uninstalled iis manually from vms02.

    now when I do
    PS C:\> Test-DscConfiguration -CimSession vms02

    InDesiredState PSComputerName
    ————– ————–
    True vms02

    why is InDesiredState showing true when it should actually be False?

    configuration NewPullServer
    {
    param
    (

    [string[]]$ComputerName = 'vms03'

    )

    Import-DSCResource -ModuleName xPSDesiredStateConfiguration

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

    xDscWebService PSDSCPullServer
    {
    Ensure = “Present”
    EndpointName = “PSDSCPullServer”
    Port = 8080
    PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer”
    CertificateThumbPrint = “AllowUnencryptedTraffic”
    ModulePath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules”
    ConfigurationPath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration”
    State = “Started”
    DependsOn = “[WindowsFeature]DSCServiceFeature”
    }

    xDscWebService PSDSCComplianceServer
    {
    Ensure = “Present”
    EndpointName = “PSDSCComplianceServer”
    Port = 9080
    PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer”
    CertificateThumbPrint = “AllowUnencryptedTraffic”
    State = “Started”
    IsComplianceServer = $true
    DependsOn = (“[WindowsFeature]DSCServiceFeature”,”[xDSCWebService]PSDSCPullServer”)
    }
    }
    }

    NewPullServer –ComputerName vms03

    Start-DscConfiguration .\NewPullServer –Wait -Verbose

    #Test the pull server
    Start-process -filepath iexplore.exe http://vms03:8080/PSDSCPullServer.svc

    Configuration VMS02WEBSITE

    {
    param ($MachineName)
    Node $MachineName

    {
    #Install the IIS Role
    WindowsFeature IIS
    {
    Ensure = “Present”
    Name = “Web-Server”
    }
    #Install web-mgmt tools
    WindowsFeature Web-Mgmt-Tools
    {
    Ensure = “Present”
    Name = “Web-Mgmt-Tools”
    }
    }
    }

    VMS02WEBSITE –MachineName “Vms02"

    [guid]::NewGuid()

    $target = "C:\Program Files\WindowsPowerShell\DscService\Configuration"

    New-DSCCheckSum $target

    Configuration SetPullMode
    {
    param([string]$guid)
    Node vms02
    {
    LocalConfigurationManager
    {
    ConfigurationMode = 'ApplyAndAutoCorrect'
    ConfigurationID = $guid
    RefreshMode = 'Pull'
    DownloadManagerName = 'WebDownloadManager'
    DownloadManagerCustomData = @{
    ServerUrl = 'http://vms03:8080/PSDSCPullServer.svc';
    AllowUnsecureConnection = 'true' }
    }
    }
    }
    SetPullMode –guid $Guid

    Set-DSCLocalConfigurationManager –Computer vms02 -Path C:\SetPullMode –Verbose

    #51447
    Profile photo of Soma sympli
    Soma sympli
    Participant

    code

    #51455
    Profile photo of Steve Groner
    Steve Groner
    Participant

    When you installed DSC Service on vms02 that installs a Local Configuration Manager. The local configuration manager has no reliance on IIS unless it is pulling from a pull server. When it connects to the pull server it downloads a config to the local machine and sets that config as current. When the LCM does its local timed check to see if the machine is in desired state it is may look to the Pull Server for an updated config. If it doesn't find it, it then uses the last config that it had, which is called Current. If you want to remove desired state config from a node, first remove-dscconfiguartiondocument -stage current, previous, pending -force and then remove the desired state config service. This will remove all config mgmt. from the node.

    Configs are stored locally and executed locally in case there it cannot reach the pull server for a period of time. Does that answer the question?

    #51457
    Profile photo of Steve Groner
    Steve Groner
    Participant

    Actually, I am sorry I re-read your question, I see that my response was not appropriate to your question. My apologies.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.