Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xDscWebService: Redeploy DSC Pull Server fails with error #460

Closed
tmeckel opened this issue Nov 13, 2018 · 4 comments · Fixed by #507
Closed

xDscWebService: Redeploy DSC Pull Server fails with error #460

tmeckel opened this issue Nov 13, 2018 · 4 comments · Fixed by #507
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@tmeckel
Copy link
Contributor

tmeckel commented Nov 13, 2018

Details of the scenario you tried and the problem that is occurring

After a successfully configuration (deployment) of a DSC Pull Server via the xDscWebService resource, a redepolyment after the deletion of the IIS Webapplication failes with an error.

Verbose logs showing the problem

VERBOSE: [UIDEFFMIMD54SPS]:                            [[xDSCWebService]PSDSCPullServer] Pull Server: Set values into the web.config that indicate the location of repository, configuration
, modules
VERBOSE: [UIDEFFMIMD54SPS]:                            [[xDSCWebService]PSDSCPullServer] Enabling Pull Server to run in a 64 bit process
The process cannot access the file 'C:\Windows\System32\inetsrv\IISSelfSignedCertModule.dll' because it is being used by another process.
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand
    + PSComputerName        : localhost
 
VERBOSE: [UIDEFFMIMD54SPS]: LCM:  [ End    Set      ]  [[xDSCWebService]PSDSCPullServer]  in 5.5680 seconds.
The PowerShell DSC resource '[xDSCWebService]PSDSCPullServer' with SourceInfo 'E:\Projects\DSC\HTTPPullServer.ps1::40::9::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        : localhost

Suggested solution to the issue

By looking at the implementation (https://github.com/PowerShell/xPSDesiredStateConfiguration/blob/01383b317abae8de69a1c093ddb51b2a064f8296/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1#L451) there should be a test if the module is already added to the globalModules section of the IIS instance and if so omit the installation. The easiest way to do is querying the the globalModules section and locate the module via a regex match:

if (-not ((& $script:appCmd list config -section:system.webServer/globalModules) -match "IISSelfSignedCertModule")) {
   ...INSTALL MODULE...
}

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration HTTPPullServer {

    Import-DSCResource -ModuleName xPSDesiredStateConfiguration

    Node $NodeName
    {
        WindowsFeature DSCServiceFeature
        {
            Ensure = "Present"
            Name   = "DSC-Service"
        }

        xDscWebService PSDSCPullServer
        {
            Ensure                  = $State
            EndpointName            = $EndpointName
            Port                    = $Port
            PhysicalPath            = "$env:SystemDrive\inetpub\PSDSCPullServer"
            CertificateThumbPrint   = $certificateThumbPrint
            ModulePath              = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
            ConfigurationPath       = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
            State                   = "Started"
            DependsOn               = "[WindowsFeature]DSCServiceFeature"
            RegistrationKeyPath     = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
            AcceptSelfSignedCertificates = $true
            Enable32BitAppOnWin64   = $false
            UseSecurityBestPractices = $false
        }

        File RegistrationKeyFile
        {
            Ensure          = $State
            Type            = 'File'
            DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
            Contents        = $RegistrationKey
            DependsOn       = "[WindowsFeature]DSCServiceFeature"
        }
    }
}

The operating system the target node is running

OsName               : Microsoft Windows Server 2012 R2 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 9600.19125.amd64fre.winblue_ltsb.180812-0703
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.14409.1012
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1012
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

ResourceType  : MSFT_xDSCWebService
Name          : xDSCWebService
FriendlyName  : xDSCWebService
Module        : xPSDesiredStateConfiguration
ModuleName    : xPSDesiredStateConfiguration
Version       : 8.4.0.0
Path          : C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\8.4.0.0\DSCResources\MSFT_xDSCWebService\MSFT_xDSCWebService.psm1
ParentPath    : C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\8.4.0.0\DSCResources\MSFT_xDSCWebService
ImplementedAs : PowerShell
CompanyName   : Microsoft Corporation
@tmeckel tmeckel changed the title xDscWebService: Redeploy DSC Pull Server xDscWebService: Redeploy DSC Pull Server fails with error Nov 13, 2018
@stale
Copy link

stale bot commented Dec 13, 2018

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Dec 13, 2018
@stale
Copy link

stale bot commented Jan 25, 2019

This issue has been automatically closed because it is has not had activity from the community in the last 40 days.

@stale stale bot closed this as completed Jan 25, 2019
@mhendric
Copy link
Contributor

Reopening issue and making it not stale.

@mhendric mhendric reopened this Jan 25, 2019
@mhendric mhendric removed the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Jan 25, 2019
@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jan 25, 2019
@PlagueHO
Copy link
Member

Tagging as bug so that stalebot doesn't auto close.

mhendric added a commit that referenced this issue Feb 25, 2019
MSFT_xDSCWebService.psm1: Applied fix for issue #460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants