Error trying to create a Pull Server

Tagged: ,

This topic contains 6 replies, has 3 voices, and was last updated by Profile photo of Indhu Krishna Sivaramakrishnan Indhu Krishna Sivaramakrishnan 5 months ago.

  • Author
    Posts
  • #43961
    Profile photo of Ed O'Connor
    Ed O’Connor
    Participant

    All,

    I am in the process of rebuilding my test DSC Pull server and it is not working. All the event logs show is a generic error:

    The PowerShell DSC resource '[xDSCWebService]PSDSCPullServer' with SourceInfo 'C:\Scripts\Set-DscPullServer1.ps1::35::9::xDscWebService' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW
    channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName : lab-dsc-01.lab2.com

    When I push the config using the -verbose switch it seems that it is erroring out on the Check Port portion telling me I can't call a null value.

    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Check Port
    You cannot call a method on a null-valued expression.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName : lab-dsc-01.lab2.com

    Right now I am totally lost as I have totally uninstalled IIS and and the DSC Service features. I tried both the xPSDesiredStateConfiguration modules 3.9.0.0 and 3.10.0.0

    Here is my script to create the pull server

    # DSC configuration for Pull Server
    # Prerequisite: Certificate "CN=PSDSCPullServerCert" in "CERT:\LocalMachine\MY\" store
    # Note: A Certificate may be generated using MakeCert.exe: http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968%28v=vs.85%29.aspx
    
    configuration DscWebService
    {
        param 
        (
            [string[]]$NodeName = 'localhost',
    
            [ValidateNotNullOrEmpty()]
            [string] $certificateThumbPrint = “AllowUnencryptedTraffic”
        )
    
        Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    
        Node $NodeName
        {
    		WindowsFeature FileServer
             {
    			Ensure = "Present"
    			Name = "FS-FileServer"
             }
             WindowsFeature StorageServices
             {
    			Ensure = "Present"
    			Name = "Storage-Services"
             }
             WindowsFeature DSCServiceFeature 
             { 
                 Ensure = "Present" 
                 Name   = "DSC-Service"             
             }
    
            xDscWebService PSDSCPullServer
            {
                Ensure                  = "Present"
                EndpointName            = "PSDSCPullServer"
                Port                    = 8080
                PhysicalPath            = "$env:SystemDrive\inetpub\PSDSCPullServer"
                CertificateThumbPrint   = "AllowUnencryptedTraffic"        
                ModulePath              = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
                ConfigurationPath       = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"            
                State                   = "Started"
                DependsOn               = "[WindowsFeature]DSCServiceFeature"                        
            }
        }
     }
    
     #This line actually calls the function above to create the MOF file.
    
    DscWebService –NodeName "lab-dsc-01.lab2.mckinsey.com"
    
    Start-DSCConfiguration .\DscWebService -Wait -Verbose
    
  • #43991
    Profile photo of Arie H
    Arie H
    Participant

    Hi,
    Something else installed on the server that holds port 8080 ?
    – Try a different port.
    – Try without the two WindowsFeatures

    If you have in your IIS website a tool called URLScan, try looking at those logs as well to see any errors

  • #44550
    Profile photo of Ed O'Connor
    Ed O’Connor
    Participant

    I am still having issues with this. I totally rebuilt the server from MS ISO image (w2012r2) and installed/am using xPSDesiredStateConfiguration module version 3.10.0.0. I have installed wmf5 and fully patched the server. I took the Sample_xDSCWebService to create the pull server with minor changes (setting CertificateThumbPrint = "AllowUnencryptedTraffic"):

    # DSC configuration for Pull Server
    # Prerequisite: Certificate "CN=PSDSCPullServerCert" in "CERT:\LocalMachine\MY\" store for SSL
    # Prerequisite: $RegistrationKey value generated using ([guid]::NewGuid()).Guid
    # Note: A Certificate may be generated using MakeCert.exe: http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968%28v=vs.85%29.aspx
    
    configuration LabDscWebService 
    { 
        param  
        ( 
                [string[]]$NodeName = 'localhost', 
    
                [Parameter(HelpMessage='Use AllowUnencryptedTraffic for setting up a non SSL based endpoint (Recommended only for test purpose)')]
                [ValidateNotNullOrEmpty()] 
                [string] $certificateThumbPrint,
    
                [Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server.  We will use new GUID by default.')]
                [ValidateNotNullOrEmpty()]
                [string] $RegistrationKey = ([guid]::NewGuid()).Guid
         ) 
    
    
         Import-DSCResource -ModuleName xPSDesiredStateConfiguration
         Import-DSCResource -ModuleName PSDesiredStateConfiguration 
    
         Node $NodeName 
         { 
             WindowsFeature DSCServiceFeature 
             { 
                 Ensure = "Present" 
                 Name   = "DSC-Service"             
             } 
    
    
             xDscWebService PSDSCPullServer 
             { 
                 Ensure                  = "Present" 
                 EndpointName            = "PSDSCPullServer" 
                 Port                    = 8080 
                 PhysicalPath            = "$env:SystemDrive\inetpub\PSDSCPullServer" 
                 CertificateThumbPrint   = "AllowUnencryptedTraffic"          
                 ModulePath              = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" 
                 ConfigurationPath       = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"             
                 State                   = "Started" 
                 DependsOn               = "[WindowsFeature]DSCServiceFeature"                         
             } 
    
            File RegistrationKeyFile
            {
                Ensure          ='Present'
                Type            = 'File'
                DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
                Contents        = $RegistrationKey
            }
        }
    }
    #This line actually calls the function above to create the MOF file.
    
    LabDscWebService –NodeName "lab-dsc-01.lab2.mckinsey.com"
    
    Start-DSCConfiguration .\LabDscWebService -Wait -verbose
    

    Upon runnning I keep getting the following errors:

    VERBOSE: [LAB-DSC-01]: LCM: [ Start Resource ] [[xDSCWebService]PSDSCPullServer]
    VERBOSE: [LAB-DSC-01]: LCM: [ Start Test ] [[xDSCWebService]PSDSCPullServer]
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Check Ensure
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] The Website PSDSCPullServer is not present
    VERBOSE: [LAB-DSC-01]: LCM: [ End Test ] [[xDSCWebService]PSDSCPullServer] in 18.8750 seconds.
    VERBOSE: [LAB-DSC-01]: LCM: [ Start Set ] [[xDSCWebService]PSDSCPullServer]
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Create the IIS endpoint
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Setting up endpoint at – http://LAB-DSC-01:8080/PSDSCPullServer.svc
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Checking IIS requirements
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Delete the App Pool if it exists
    VERBOSE: [LAB-DSC-01]: [[xDSCWebService]PSDSCPullServer] Remove the site if it already exists
    The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : BadExpression
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : BadExpression
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : BadExpression
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    VERBOSE: [LAB-DSC-01]: LCM: [ End Set ] [[xDSCWebService]PSDSCPullServer] in 6.3250 seconds.
    The PowerShell DSC resource '[xDSCWebService]PSDSCPullServer' with SourceInfo 'C:\Temp\Set-DSCPullServer.ps1::34::10::xDscWebService' threw one or more non-terminating
    errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel
    for more details.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    VERBOSE: [LAB-DSC-01]: LCM: [ Start Resource ] [[File]RegistrationKeyFile]
    VERBOSE: [LAB-DSC-01]: LCM: [ Start Test ] [[File]RegistrationKeyFile]
    VERBOSE: [LAB-DSC-01]: [[File]RegistrationKeyFile] The system cannot find the file specified.
    VERBOSE: [LAB-DSC-01]: [[File]RegistrationKeyFile] The related file/directory is: C:\Program Files\WindowsPowerShell\DscService\RegistrationKey
    s.txt.
    VERBOSE: [LAB-DSC-01]: LCM: [ End Test ] [[File]RegistrationKeyFile] in 0.2190 seconds.
    VERBOSE: [LAB-DSC-01]: LCM: [ Start Set ] [[File]RegistrationKeyFile]
    VERBOSE: [LAB-DSC-01]: [[File]RegistrationKeyFile] The system cannot find the file specified.
    VERBOSE: [LAB-DSC-01]: [[File]RegistrationKeyFile] The related file/directory is: C:\Program Files\WindowsPowerShell\DscService\RegistrationKey
    s.txt.
    VERBOSE: [LAB-DSC-01]: LCM: [ End Set ] [[File]RegistrationKeyFile] in 0.0150 seconds.
    VERBOSE: [LAB-DSC-01]: LCM: [ End Resource ] [[File]RegistrationKeyFile]
    VERBOSE: [LAB-DSC-01]: LCM: [ End Set ]
    The SendConfigurationApply function did not succeed.
    + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    VERBOSE: Operation 'Invoke CimMethod' complete.
    VERBOSE: Time taken for configuration job to complete is 416.598 seconds

    The DSC operational event log shows the same errors as specified above and nothing else. Prior to the rebuild when I was getting the same error the debug logs also did not give any further information other than the generic error:

    The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : BadExpression
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com

    Please help I am lost right now.

  • #44557
    Profile photo of Arie H
    Arie H
    Participant

    Two things that come to mind:

    I remember Nitin discussing similar issue. The possible remedy was, iirc, to try this with version 3.9.0.0

    For the sake of my doubting mind, can you change $RegistrationKey to have a value and not a [guid].

    Note that what the other post issue was that the content of the RegistrationKeys.txt was different then
    what was in the actual value in the LCM, make sure yours match.

  • #44592
    Profile photo of Ed O'Connor
    Ed O’Connor
    Participant

    Ok, I am not sure what is going on but I deleted the pending.mof from the server and reran the exact same script and it went through with no errors. I cannot confirm this but this error seems to be tied to the RegistrationKeys.txt but not sure how. Once I got the script to go through I pushed my configs out to my nodes and was getting a error that it could not due to a invalid RegistrationKey. When I looked in the file, the formatting was all wrong/corrupt. I deleted all the data out, my config scripts get the GUID from AD for the servers I want to apply DSC to and creates/appends the RegistrationKeys.txt file. Upon rerunning it did enter the keys but in a very weird format (the text was larger and spread out). I then deleted the RegistrationKeys.txt and ran my config once again and it went through with no issues. My nodes are now applying the DSC config I specified for them.

    Once this completes I am going to revert my snapshot to a clean install and try to create the Pull server again for more detailed troubleshooting. I will revert with my findings once completed.

  • #45358
    Profile photo of Ed O'Connor
    Ed O’Connor
    Participant

    Ok, here is what I have found but not sure what to do about it.

    I have totally simplified the script that creates the Pull Server. I am starting with a Windows 2012 server fully patched as of 6/28/16 with File Server, Storage Server, and DSC Service features installed.

    Here is my code to create the Pull Server:

    # DSC configuration for Pull Server
    
    
    configuration LabDscWebService 
    { 
        param  
        ( 
                [string[]]$NodeName = 'localhost'
    
         ) 
    
    
         Import-DSCResource -ModuleName xPSDesiredStateConfiguration
    
         Node $NodeName 
         {  
             xDscWebService LabDSCPullServer 
             { 
                 Ensure                  = "Present" 
                 EndpointName            = "LabDSCPullServer" 
                 Port                    = 8080 
                 PhysicalPath            = "$env:SystemDrive\inetpub\LabDSCPullServer" 
                 CertificateThumbPrint   = “AllowUnencryptedTraffic”          
                 ModulePath              = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules" 
                 ConfigurationPath       = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"             
                 State                   = "Started"                         
             } 
    
    
    
        }
    }
    
    #This line actually calls the function above to create the MOF file.
    
    LabDscWebService –NodeName "lab-dsc-01.lab2.mckinsey.com"
    
    Start-DSCConfiguration .\LabDscWebService -Wait -verbose
    

    When running this I get errors:
    3 of these:
    "The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : BadExpression
    + PSComputerName : lab-dsc-01.lab2.mckinsey.com"

    and
    the SendConfigurationApply function did not succeed.

    If I go to the Operational event log for DSC the only errors specified contain the exact same message as listed above. In the Anayltic log I do see a event (4183) 10x saying:

    "Failed attempt number x : Couldn't delete file C:\Windows\System32\Configuration\DSCEngineCache.mof . The error code is 2. The error message is: The system cannot find the file specified."

    If I delete the pending mof and rerun it goes through with no errors.

    I have opened the MSFT_xDSCWebService.psm1 script and believe I have narrowed the problematic code to lines 247 through 261:

        if($AcceptSelfSignedCertificates)
        {
            Copy-Item "$pathPullServer\IISSelfSignedCertModule.dll" $env:windir\System32\inetsrv -Force
            Copy-Item "$env:windir\SysWOW64\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PullServer\IISSelfSignedCertModule.dll" $env:windir\SysWOW64\inetsrv -Force
    
            & $script:appCmd install module /name:"IISSelfSignedCertModule(32bit)" /image:$env:windir\SysWOW64\inetsrv\IISSelfSignedCertModule.dll /add:false /lock:false
            & $script:appCmd add module /name:"IISSelfSignedCertModule(32bit)"  /app.name:"PSDSCPullServer/"
        }
        else
        {
            if($AcceptSelfSignedCertificates -and ($AcceptSelfSignedCertificates -eq $false))
            {
                & $script:appCmd delete module /name:"IISSelfSignedCertModule(32bit)"  /app.name:"PSDSCPullServer/"
            }
        }
    

    This is the only section of the code under the Set-TargetResource that has three "&" which corresponds with the number of expression errors I am getting. My programming skills are not at a level where I know what to do to correct this. If someone with a little more skill could take a look at this and suggest a update it would be greatly appreciated. Also, as I have seen multiple threads with people getting this same error as me and simply ignoring it, perhaps someone from MS could update the actual module. I know the error comes up in versions 3.9.0.0 and 3.10.0.0.

    I hope this helps someone clear this issue up.

  • #46049

    Hello Ed,

    This error is due to the 3.10.0.0 version of xpsdesiredstateconfiguration. If you move to a later version, you should not be seeing this issue.

    Indhu

You must be logged in to reply to this topic.