Troubleshooting DSC for Configuration Management (Problem and Solution)

Background:  DSC is a toolkit of PowerShell cmdlets that enable you to do configuration management.  It can allow you to do CM tasks with Windows and Linux machines (https://msdn.microsoft.com/en-us/powershell/dsc/LnxGettingStarted).

Problem/Scenario:  You are trying to use this PowerShell command (e.g., to test your Desired State Configuration tool):

Enter-PSSession -ComputerName goodServer -Credential jdoe

# where goodServer is a Windows server on the network and jdoe is a local user account on the goodServer machine.
# There may be a pop up for the password associated with jdoe.  You may enter the correct one.  But you are encountering an error like this:

"Enter-PSSession : Connecting to remote server goodServer failed with the following error message : WinRM cannot process the request.  The following error with the errorcode ... occurred while using Kerberos authentication: There are currently no logon servers available to service the logon request.  Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains.
-After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication."

The event viewer has no leads for this problem.

Solution:
Prerequisite: You are logged on with local credentials to a Windows server that happen to be the same username and password as the credentials of the remote server ("goodServer" in this example).
1) Open PowerShell as an Administrator
2) Run this in PowerShell:

Set-Item wsman:\localhost\client\trustedhosts *

3) Respond "Yes" to the two following prompts.  The problem should now go away.
------------
See this: https://sqlbelle.com/2015/02/09/installing-sql-server-using-powershell-desired-state-configuration-dsc/

Attached files taken from: https://www.youtube.com/watch?v=bz3D5ciOdgo
Start-DscConfiguration -Path C:\Users\Mike\Documents\SqlServerInstall  -Wait -Verbose

Leave a comment

Your email address will not be published.