Author Posts

April 25, 2018 at 8:30 am

Hi

I have a problem with my clients reporting in a non standard way to my Report Server. I firmly believe it is a configuration error, so I'm after some advice 🙂

My HTTPS Pull Server config:

configuration HTTPSPullServer
{
    # Modules must exist on target pull server
    Import-DSCResource -ModuleName xPSDesiredStateConfiguration

    Node k3llymgmt01 {

        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   = 'bcc169e3d45ce98a07610d7480fc7b3af07f17b1'
            ModulePath              = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
            ConfigurationPath       = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
            State                   = "Started"
            DependsOn               = "[WindowsFeature]DSCServiceFeature"
            UseSecurityBestPractices = $true
        }      
    }
}

# Generate MOF
HTTPSPullServer -OutputPath C:\DSC\configMOF\https\

My LCM config:


[DSCLocalConfigurationManager()]
Configuration LCM_HTTPSPULL 
{
    param
        (
            [Parameter(Mandatory=$true)]
            [string[]]$ComputerName,

            [Parameter(Mandatory=$true)]
            [string]$guid

        )      	
	Node $ComputerName {
	
		Settings {
		
			AllowModuleOverwrite = $True
            ConfigurationMode = 'ApplyAndAutoCorrect'
			RefreshMode = 'Pull'
            ConfigurationID = $guid
            RebootNodeIfNeeded = $true
            ActionAfterReboot = 'ContinueConfiguration'
            RefreshFrequencyMins = 30 

            }

            ConfigurationRepositoryWeb K3lly_PullServer {                
                ServerURL = 'https://k3llymgmt01.k3lly.com:8080/psdscpullserver.svc'
                CertificateID = 'bcc169e3d45ce98a07610d7480fc7b3af07f17b1'
                AllowUnsecureConnection = $False
            }            

            ReportServerWeb K3lly_ReportServer
            {
                ServerURL = 'https://k3llymgmt01.k3lly.com:8080/psdscpullserver.svc'
                CertificateID = 'bcc169e3d45ce98a07610d7480fc7b3af07f17b1'
                AllowUnsecureConnection = $false
            }	
	}
}

# Computer list 
$ComputerName='k3llysrv01','k3llysrv02', 'k3llyweb02','k3llyweb03'

# Create Guid for the computers
$guid=[guid]::NewGuid()

# Create the Computer.Meta.Mof in folder
LCM_HTTPSPULL -ComputerName $ComputerName -Guid $guid -OutputPath C:\DSC\lcmMOF\https\

When I browse to here: https://k3llymgmt01.k3lly.com:8080/psdscpullserver.svc/ , I get what I expect

However, when I browse to here: https://k3llymgmt01.k3lly.com:8080/psdscpullserver.svc/Nodes(AgentId='AF812916-414B-11E8-9A9C-00155D035606')/Reports , I get no infortmation on the Agent

I have downloaded a DB viewer and had a look at the "devices.edb" file and I can see my clients are reporting correctly.
I have checked the windows event logs on the clients, are they are reporting that they can can send reports back to my pull server.

Its just that I get no information from the browser.

Any ideas what the problem is?

April 26, 2018 at 8:35 am

I think I may have found why I have this problem: https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/97

It looks like I need to query by "ConfigurationId" and not "AgentId".


function GetReport
{
    #param($AgentId = "$((glcm).AgentId)", $serviceURL = "https://$($PullServer):8080/PSDSCPullServer.svc")
    param($ConfigurationId = "$((glcm).ConfigurationId)", $serviceURL = "https://$($PullServer):8080/PSDSCPullServer.svc")
    #$requestUri = "$serviceURL/Nodes(AgentId= '$AgentId')/Reports"

    $requestUri = "$serviceURL/Node(ConfigurationId= '$ConfigurationId')/StatusReports" 
    $request = Invoke-WebRequest -Uri $requestUri -ContentType "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" `
               -UseBasicParsing -Headers @{Accept = "application/json";ProtocolVersion = "2.0"}

    $object = ConvertFrom-Json $request.content
    return $object.value
}