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

WinRM error after using the xPendingReboot resource #48

Open
yohanb opened this issue Dec 21, 2016 · 6 comments
Open

WinRM error after using the xPendingReboot resource #48

yohanb opened this issue Dec 21, 2016 · 6 comments
Labels

Comments

@yohanb
Copy link

yohanb commented Dec 21, 2016

Hi,

I'm joining a domain using DSC after I have to reboot the machine afterwards. I'm using the xPendingReboot resource from the XComputerManagement module. I'm getting this error from Vagrant after DSC reboots the machine:
image

Any ideas? Thanks.

@mefellows mefellows added the bug label Dec 21, 2016
@mefellows
Copy link
Owner

Hi @yohanb, I haven't seen that one before.

Looks like there are a few other bugs related to this in upstream packages:

Might be related?

I suppose it's possible that WinRM just doesn't like the restart?

@StefanSchoof
Copy link
Collaborator

I have not seen this error, but some similar.

I think the join domain, set the required reboot in dsc itself and you need no xPendingReboot. But you need to configure your machine to do a reboot (I solved this currently with something like: https://github.com/mefellows/vagrant-dsc/blob/master/development/reboot/Vagrantfile#L4)

What happens if you run after the reboot has finished a vagrant provision? I had some boxes where after a domain join the vagrant user does no longer works (got a timeout). I never inspected this in the deep, just use a other box. I used the mwrock\windows2016 box to join a domain and it works.

Can your share your vagrant and dsc file?

@yohanb
Copy link
Author

yohanb commented Dec 22, 2016

@StefanSchoof sure! I've obviously removed any account info from the files.

Vagrant file:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.box = "mwrock/Windows2016"

  config.vm.guest = :windows
  config.vm.communicator = "winrm"
  config.winrm.max_tries = 40

  config.vm.network "public_network"
  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.provider "virtualbox" do |vbox|
    vbox.memory = "2048"
  end

  config.vm.provision :shell, path: "DSCConfig.ps1"

  config.vm.provision "dsc" do |dsc|

    dsc.configuration_name = "SQLExpress"
    dsc.configuration_file  = "SQLExpress.ps1"
    dsc.configuration_data_file  = "manifests/SQLExpress.psd1"

    dsc.manifests_path = "manifests"
    dsc.temp_dir = "c:/tmp/vagrant-dsc"

    dsc.module_install = ["xSQLServer", "xPendingReboot", "xComputerManagement"]
    dsc.configuration_params = 
    { 
      "-SourceFolder" => "vagrant-dsc/manifests/sources/SQLEXPRWT_x64_ENU",
      "-DomainCredentials" => "",
      "-SetupCredential" => "" }
  end

end

DSC LCM Config:

[DSCLocalConfigurationManager()]
configuration LCMConfig
{
    Node localhost
    {
        Settings
        {
            RebootNodeIfNeeded = $true
            ActionAfterReboot = 'ContinueConfiguration'
        }
    }
}

LCMConfig -OutputPath .\mof -Verbose
Set-DscLocalConfigurationManager -Path .\mof

DSC file:

Configuration SQLExpress
{
    param ($SourceFolder, $DomainCredential, $SetupCredential)

    Import-DscResource -Module xSQLServer
    Import-DscResource -Module xPendingReboot
    Import-DscResource -Module xComputerManagement
    
    $SourcePath = Split-Path -Path $script:MyInvocation.MyCommand.Path -Parent

    Node $AllNodes.NodeName
    {
        LocalConfigurationManager
        {
            DebugMode = "ForceModuleImport"
            RebootNodeIfNeeded = $true
            ActionAfterReboot = 'ContinueConfiguration'
        }

        xComputer JoinDomain
        {
            Name = "yb-dev"
            DomainName = "dev.office.com"
            Credential = $DomainCredential
        }

        xPendingReboot RebootNodeIfNeeded
        {
            Name = "Pending reboot"
            DependsOn = '[xComputer]JoinDomain'
        }

        # SQL Server Express
        xSqlServerSetup ("{0}-{1}" -f $Node.NodeName, $Node.InstanceName)
        {
            SourcePath = $SourcePath
            SourceFolder = $SourceFolder
            SetupCredential = $SetupCredential
            InstanceName = $Node.InstanceName
            Features = $Node.Features
            InstallSharedDir =  $Node.InstallSharedDir
            InstallSharedWOWDir =  $Node.InstallSharedWOWDir
            InstanceDir =  $Node.InstanceDir
            InstallSQLDataDir =  $Node.InstallSQLDataDir
            SQLUserDBDir =  $Node.SQLUserDBDir
            SQLUserDBLogDir =  $Node.SQLUserDBLogDir
            SQLTempDBDir =  $Node.SQLTempDBDir
            SQLTempDBLogDir =  $Node.SQLTempDBLogDir
            SQLBackupDir =  $Node.SQLBackupDir
        }

        xSqlServerFirewall ("{0}-{1}" -f $Node.NodeName, $Node.InstanceName)
        {
            DependsOn = ("[xSqlServerSetup]$("{0}-{1}" -f $Node.NodeName, $Node.InstanceName)")
            SourcePath = $SourcePath
            SourceFolder = $SourceFolder
            InstanceName = $Node.InstanceName
            Features = $Node.Features
        }

        xSQLServerNetwork ("{0}-{1}" -f $Node.NodeName, $Node.InstanceName)
        {
            DependsOn = @("[xSqlServerSetup]$("{0}-{1}" -f $Node.NodeName, $Node.InstanceName)")
            InstanceName = $Node.InstanceName
            ProtocolName = "tcp"
            IsEnabled = $true
            TCPPort = $Node.TCPPort
            RestartService = $true 
        }
    }
}

@StefanSchoof
Copy link
Collaborator

I will look at it, but this may take some time.

@StefanSchoof
Copy link
Collaborator

I tried to reproduce and I do not get the error. I run Win10, Vagrant 1.9.1, Virtualbox 5.1.12.

@mefellows
Copy link
Owner

Thanks @StefanSchoof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants