Reboot is required but does not happen

Hi,

I have a DSC script that installs IIS on a 2008R2 server. Rather than install the whole IIS role, we pick an choose the features we want. After the features are all installed, I go ahead and configure the web sites.

What I am finding is that the script fails when I am configuring the apppools. However if I reboot the server and rerun the script, it runs all the way through with no errors.

How can I force a reboot after the feature install and have the script pick up where it left off or even just start over. Either way would work for me.

I added the xPendingReboot module from the latest wave, right after the WindowsFeature module but that just skips on through.’

WindowsFeature as-was-support
{
Name = “as-was-support”
Ensure = “Present”
# Source = $Source
}

Needs restart

	xPendingReboot Reboot1
    { 
        Name = 'BeforeSoftwareInstall'
    }
    LocalConfigurationManager
    {
        RebootNodeIfNeeded = 'True'
    } 

OldDog

I don’t think you can do that using the built-in WindowsFeature resource; you’d need to build a custom one. The provided resource only sets the reboot flag if Install-WindowsFeature indicates that a reboot is required. If that cmdlet doesn’t indicate a needed reboot, there won’t be one.

xPendingReboot only acts on a pending reboot; it doesn’t trigger a pending reboot.

OK,

My next thought is to set up a PS script to

  1. Run the DSC script,
  2. set the RunOnceKey to start the DSC script again
  3. Restart the server
  4. Hope for the best, plan for the worst.

OldDog

In a custom DSC resource, I believe setting $global:DSCMachineStatus = 1 in the Set-TargetResource function will force a reboot,

It will only force a reboot if that is set in the Local Configuration Manager properties.

Something like this:

configuration LCM {

    Node localhost
        {

            LocalConfigurationManager
                {
                    RebootNodeIfNeeded = $true
                }
        }
}

Cheers,
David

Hi,

Looks like what really is happening is that I need to run an iisreset once or twice to get the script to go all the way through with out errors.

I’ll start another tread about that.

OldDog