Hello,
I am using The DSC Book (forever edition) as a guide for setting up a DSC Pull Server. (Yes, I paid for it
I can’t get it to work and I am currently stumped. This is my first post, so please let me know if I am doing it wrong.
The environment is a very simple Windows 2016 domain. It has:
• A DC that also runs DNS and Certificate Services, 2016 Server Core
• A utility server that runs 2016 GUI with Management Tools
• A system dedicated to being a DSC Pull Server, 2016 Server Core
As noted above, I did create my own Certificate Service server, and issued a root certificate which is stored in cert:\localmachine\my on the target servers.
I tried installing a Pull Server on both the 2016 Server Core system as well as the 2016 GUI system, since The DSC Book notes that xPSDesiredStateConfiguration has had issues with Server Core. However, it errors out exactly the same way, in the same place.
I am not doing any remoting other than RDP (i.e. no WinRM or SSH). All systems are virtual machines running on ESX.
What appears to be the core error - “A specified logon session does not exist. It may already have been terminated” - seems to be associated with CredSSP double hop issues, as well as the formatting of credentials on Azure (name@domain vs DOMAIN\name). I tried applying the MOF logged in both ways, and it fails the same way regardless.
Everything is running Powershell 5.1 and WMF 5.1. NuGet is version 2.8.5.208. Module Versions:
• PSDSCResources 2.8.0.0
• PsDesiredStateConfiguration 1.1
• xPsDesiredStateConfiguration 7.0.0.0
The symptoms are:
The IIS site for the Pull Server is physically present but not running. I cannot get to the URL for the Pull Server. The Pull Server site does not show up in IIS Manager. I get multiple errors while applying the MOF to the node.
I get a logon error when configuring the IIS site:
A specified logon session does not exist. It may already have been terminated
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.NewItemCommand
+ PSComputerName : myServer-dsc01.myServer.lab
I also get an error about DestinationPath and directories, which is confusing, as the only place I’m using DestinationPath is File RegistrationKeyFile, and I’m specifying a file, not a directory:
File RegistrationKeyFile {
Ensure = 'Present'
Type = 'File' # not directory
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $registrationKey
}
Yet I still get this error:
DestinationPath cannot be a directory for current configuration. Specify Force if you want to perform the configuration. The related ResourceID is [File]RegistrationKeyFile.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : MI RESULT 4
+ PSComputerName : darkmeld-dsc01.darkmeld.lab
The RegistrationKeys.txt file exists, but it’s empty.
I get this error at the end:
The PowerShell DSC resource '[xDSCWebService]PSDSCPullServer' with SourceInfo 'C:\dsc_stuff\dscsetup-pullserver-mof.ps1::45::5::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 : myServer-dsc01.myServer.lab
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : myServer-dsc01.myServer.lab
The referenced ETW logs do not show anything new, they merely repeat the already displayed error information. I do include the ETW output below for completeness; maybe I missed something.
I found this:
DSC Pull Server Deploy Errors - xDscWebServiceRegistrationThis person was getting the same error, but it went away when he stopped using a self-signed certificate. (I also noticed a line missing from the DSC Book version of setting up a pull server regarding the Registration Key Path, and added it). I suppose it’s possible there is something wrong with my certificate setup, but to be candid this is the first time I’ve set up Certificate Services and a Certificate Authority. I did so according to this guide and got no errors while I was doing so:
Install and Configure Certificate Authority in Windows Server 2016
Here’s the configuration:
configuration myServerDscPullServer {
param (
# name of DSC pull server
[Parameter(Mandatory=$true)]
[string[]]$nodeName,
# thumbprint of root certificate
[Parameter(Mandatory=$true)]
[string]$certificateThumbPrint,
# GUID for registration
[Parameter(Mandatory=$true)]
[string]$registrationKey
)
Import-DscResource -ModuleName xPSDesiredStateConfiguration
# avoid warning
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node $nodeName {
# windows features - experimenting using DSC for these instead of install-windowsfeature
WindowsFeature DSCServiceFeature {
Ensure = 'Present'
Name = 'dsc-service'
}
WindowsFeature IISFeature {
Ensure = 'Present'
Name = 'web-server'
}
WindowsFeature IISMgmt {
Ensure = 'Present'
Name = 'web-mgmt-service'
DependsOn = '[WindowsFeature]IISFeature'
}
# windows services - experimenting instead of using powershell to configure
Service IISService {
Name = 'w3svc'
StartupType = 'Automatic'
State = 'Running'
}
# errors out on mgmt service - add pause?
Service WebMgmtService {
Name = 'wmsvc'
StartupType = 'Automatic'
State = 'Running'
}
# installing pull server from experimental module - watch out for bugs on server core
xDSCWebService PSDSCPullServer {
Ensure = 'Present'
EndpointName = 'PSDSCPullServer'
Port = 8023 # instead of 8080 because 23
# why double quotes? only for filesystem stuff?
PhysicalPath = "$env:SystemDrive\inetpub\PSDSCPullServer\"
CertificateThumbPrint = $certificateThumbPrint
ModulePath = "$env:ProgramFiles\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration"
State = 'Started'
DependsOn = @('[WindowsFeature]DSCServiceFeature','[WindowsFeature]IISFeature','[WindowsFeature]IISMgmt','[Service]IISService')
# this line is missing from the DSC book script?
RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\RegistrationKeys.txt"
UseSecurityBestPractices = $true
}
File RegistrationKeyFile {
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $registrationKey
}
# try again?
Service WebMgmtService2 {
Name = 'wmsvc'
StartupType = 'Automatic'
State = 'Running'
}
}
}
myServerDscPullServer -nodeName "myServer-dsc01.myServer.lab" -certificateThumbPrint "myThumbprint" -registrationKey "myRegistrationKey"
Here’s the output of Start-DscConfiguration: (note that there’s no error about the certificate)
PS C:\dsc_stuff> Start-DscConfiguration -path .\myServerDscPullServer\ -wait -verbose
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer myServer-DSC01 with user sid mySid.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[WindowsFeature]DSCServiceFeature]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[WindowsFeature]DSCServiceFeature]
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] The operation 'Get-WindowsFeature' started: dsc-service
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] The operation 'Get-WindowsFeature' succeeded: DSC-Service
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[WindowsFeature]DSCServiceFeature] in 2.4410 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ] [[WindowsFeature]DSCServiceFeature]
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Installation started...
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Continue with installation?
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Prerequisite processing started...
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Prerequisite processing succeeded.
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Installation succeeded.
VERBOSE: [myServer-DSC01]: [[WindowsFeature]DSCServiceFeature] Successfully installed the feature dsc-service.
VERBOSE: [myServer-DSC01]: LCM: [ End Set ] [[WindowsFeature]DSCServiceFeature] in 79.5740 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[WindowsFeature]DSCServiceFeature]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[WindowsFeature]IISFeature]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[WindowsFeature]IISFeature]
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISFeature] The operation 'Get-WindowsFeature' started: web-server
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISFeature] The operation 'Get-WindowsFeature' succeeded: Web-Server
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[WindowsFeature]IISFeature] in 1.1130 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Skip Set ] [[WindowsFeature]IISFeature]
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[WindowsFeature]IISFeature]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[WindowsFeature]IISMgmt]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[WindowsFeature]IISMgmt]
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] The operation 'Get-WindowsFeature' started: web-mgmt-service
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] The operation 'Get-WindowsFeature' succeeded: Web-Mgmt-Service
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[WindowsFeature]IISMgmt] in 0.5790 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ] [[WindowsFeature]IISMgmt]
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Installation started...
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Continue with installation?
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Prerequisite processing started...
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Prerequisite processing succeeded.
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Installation succeeded.
VERBOSE: [myServer-DSC01]: [[WindowsFeature]IISMgmt] Successfully installed the feature web-mgmt-service.
VERBOSE: [myServer-DSC01]: LCM: [ End Set ] [[WindowsFeature]IISMgmt] in 16.3530 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[WindowsFeature]IISMgmt]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[Service]IISService]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[Service]IISService]
VERBOSE: [myServer-DSC01]: [[Service]IISService] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_Service WHERE Name='w3svc','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [myServer-DSC01]: [[Service]IISService] Operation 'Query CimInstances' complete.
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[Service]IISService] in 2.2080 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Skip Set ] [[Service]IISService]
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[Service]IISService]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[Service]WebMgmtService]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[Service]WebMgmtService]
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_Service WHERE Name='wmsvc','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Operation 'Query CimInstances' complete.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Startup type for service 'WMSvc' is 'Manual'. It does not match 'Automatic'.
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[Service]WebMgmtService] in 0.2040 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ] [[Service]WebMgmtService]
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Service 'wmsvc' already exists. Write properties such as Status, DisplayName, Description, Dependencies will be ignored for existing services.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_Service WHERE Name='wmsvc','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Operation 'Query CimInstances' complete.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Perform operation 'Invoke CimMethod' with following parameters, ''instance' = Win32_Service: Web Management Service (Name = "WMSvc"),'methodName' = Change,'namespaceName' = root/cimv2'.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Operation 'Invoke CimMethod' complete.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService] Service 'wmsvc' started.
VERBOSE: [myServer-DSC01]: LCM: [ End Set ] [[Service]WebMgmtService] in 1.0810 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[Service]WebMgmtService]
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[xDSCWebService]PSDSCPullServer]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[xDSCWebService]PSDSCPullServer]
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Check Ensure
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] The Website PSDSCPullServer is not present
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[xDSCWebService]PSDSCPullServer] in 1.6290 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ] [[xDSCWebService]PSDSCPullServer]
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Create the IIS endpoint
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Setting up endpoint at - https://myServer-DSC01:8023/PSDSCPullServer.svc
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Verify that the certificate with the provided thumbprint exists in CERT:\LocalMachine\MY\
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Checking IIS requirements
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Delete the App Pool if it exists
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Remove the site if it already exists
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Create the bin folder for deploying custom dependent binaries required by the endpoint
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Adding App Pool
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Set App Pool Properties
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Add and Set Site Properties
A specified logon session does not exist. It may already have been terminated
+ CategoryInfo : NotSpecified: (:) [], CimException
+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.NewItemCommand
+ PSComputerName : myServer-dsc01.myServer.lab
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] p11
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Enabling firewall exception for
port 8023
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Disable Inbound Firewall
Notification
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Add Firewall Rule for port 8023
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Set values into the web.config
that define the repository later than BLUE OS
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Only ESENT is supported on
Windows Server 2016
VERBOSE: [myServer-DSC01]: [[xDSCWebService]PSDSCPullServer] Pull Server: Set values into
the web.config that indicate the location of repository, configuration, modules
VERBOSE: [myServer-DSC01]: LCM: [ End Set ] [[xDSCWebService]PSDSCPullServer] in 5.5770 seconds.
The PowerShell DSC resource '[xDSCWebService]PSDSCPullServer' with SourceInfo
'C:\dsc_stuff\dscsetup-pullserver-mof.ps1::45::5::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 : myServer-dsc01.myServer.lab
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[File]RegistrationKeyFile]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[File]RegistrationKeyFile]
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[File]RegistrationKeyFile] in 0.4860 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Start Set ] [[File]RegistrationKeyFile]
VERBOSE: [myServer-DSC01]: [[File]RegistrationKeyFile] DestinationPath cannot be a directory for current configuration. Specify Force if you want to perform the configuration.
DestinationPath cannot be a directory for current configuration. Specify Force if you want to perform the configuration. The related ResourceID is [File]RegistrationKeyFile.
+ CategoryInfo : InvalidArgument: (:) [], CimException
+ FullyQualifiedErrorId : MI RESULT 4
+ PSComputerName : myServer-dsc01.myServer.lab
VERBOSE: [myServer-DSC01]: LCM: [ Start Resource ] [[Service]WebMgmtService2]
VERBOSE: [myServer-DSC01]: LCM: [ Start Test ] [[Service]WebMgmtService2]
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService2] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT * FROM Win32_Service WHERE Name='wmsvc','queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: [myServer-DSC01]: [[Service]WebMgmtService2] Operation 'Query CimInstances'
complete.
VERBOSE: [myServer-DSC01]: LCM: [ End Test ] [[Service]WebMgmtService2] in 0.2350 seconds.
VERBOSE: [myServer-DSC01]: LCM: [ Skip Set ] [[Service]WebMgmtService2]
VERBOSE: [myServer-DSC01]: LCM: [ End Resource ] [[Service]WebMgmtService2]
VERBOSE: [myServer-DSC01]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : InvalidArgument: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 4
+ PSComputerName : myServer-dsc01.myServer.lab
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 115.124 seconds
PS C:\dsc_stuff>
Any ideas? I am stumped.
Thanks,
Formica