DCS connection error

This topic contains 13 replies, has 4 voices, and was last updated by Profile photo of Josh Voss Josh Voss 6 months, 1 week ago.

  • Author
    Posts
  • #15682
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    Hello,

    I'm trying to create a VHD with xvhd on my local computer. I've written the configuration and created the mof.


    Configuration CreateVHD
    {
    Import-DscResource -module xHyper-V

    xvhd NewVHD
    {
    Name = "TestVHD1"
    Path = "C:\Lab\VHD"
    Ensure = "Present"
    Generation = "vhdx"
    MaximumSizeBytes = 40GB
    }
    }
    CreateVHD

    However, when I push it with Start-DscConfiguration, I always get this error:


    The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management
    service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm
    quickconfig".
    + CategoryInfo : ConnectionError: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : HRESULT 0x80338012
    + PSComputerName : localhost

    I don't get how the heck is my computer unable to connect to itself. I've even run Enable-PSRemoting and as far as I know, LCM should run automatically. All the modules are copied to 'C:\Program Files\WindowsPowerShell\Modules' and Hyper-V is running too.

  • #15683
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Your configuration does not contain a NODE section?

    DSC doesn't use Remoting per se; it uses WS-MAN and WinRM, which are distinct technologies. If Enter-PSSession works, then DSC should be able to connect. However, what was the name of the MOF file that you produced? What was the exact Start-DscConfiguration command you ran? Normally, a configuration includes a NODE section, which identifies the machines being targeted.

  • #15684
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    I tried with the Node section now:


    Configuration CreateVHD
    {
    Import-DscResource -module xHyper-V
    Node localhost
    {
    xvhd NewVHD
    {
    Name = "TestVM1"
    Path = "C:\lab\VHD"
    Ensure = "Present"
    Generation = "vhdx"
    MaximumSizeBytes = 40GB
    }
    }
    }
    CreateVHD

    I run Start-DscConfiguration .\CreateVHD -wait, but I still get the same error.

  • #15686
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Can you run

    Enter-PSSession localhost

    Successfully?

  • #15687
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    No, I get almost the same error.

  • #15689
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Then you need to troubleshoot that, apart from DSC.

    When you run Enable-PSRemoting, you get no errors? Are you an Administrator on the computer? Is PowerShell being run as Administrator?

  • #15690
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    I see. I'll keep tracking it down. I'm an admin and I run PS as admin. When I run Enable-PSRemoting I get this:


    WinRM is already set up to receive requests on this computer.
    Set-WSManQuickConfig : WinRM firewall exception will not work since one
    of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.

    At line:69 char:17
    + Set-WSManQuickConfig -force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

    Thank you so far, I'll keep on trying!

  • #15691
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Add -SkipNetworkProfileCheck. That error's common, and well-documented. It means you have a network adapter set to "Public," usually a VM adapter.

    • #60280
      Profile photo of Josh Voss
      Josh Voss
      Participant

      Don where do we "Add -SkipNetworkProfileCheck"? I tried adding it to the "Start-DscConfiguration" cmdlet but it wasn't recognized.

      Thanks.

    • #60283
      Profile photo of Josh Voss
      Josh Voss
      Participant

      Ah you meant to add it to "Enable-PSRemoting". Thank you.

  • #15692
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Although be aware that, if you have a Public adapter, Windows Firewall will still block traffic on that adapter – so make sure it isn't the one you're actually trying to connect to.

  • #15696
    Profile photo of Istvan Szarka
    Istvan Szarka
    Participant

    Thank you, it solved the problem!
    I also added localhost to the wsman trusted host list, but that didn't help.
    Also, after Start-DscConfiguration I had to supply an absolute path, the relative path didn't work.
    Thank you lot again!

  • #15700
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Relative paths will work if they're correct; you may have been in a different folder without realizing it. And TrustedHosts has nothing to do with it; you were being blocked by Windows Firewall. Glad it's working now.

  • #15693
    Profile photo of Jacob Benson
    Jacob Benson
    Member

    I am pretty certain I had this same problem when I was trying to run a Configuration from ISE (which wasn't running as Administrator, it was running as a privileged account). Running the console or ISE as Administrator fixed the issue.

    If that's not it, what version is the desktop OS you are trying to run this on? I took this section from the DSC e-Book:
    On Windows 8.1 and Windows Server 2012 R2, make certain that KB2883200 is installed or DSC will not work. On Windows Server 2008 R2, Windows 7, and Windows Server 2008, be sure to install the full Microsoft .NET Framework 4.5 package prior to installing WMF 4.0 or DSC may not work correctly.

You must be logged in to reply to this topic.