Unexpected Token ‘}’ in Expression or Statement when using $AllNodes in a Desired State Configuration

I was working on testing a custom DSC Resource when I came across a very strange issue. Whenever I tried to build a Configuration like the one below, it failed.

First Configuration:
$ConfigData =@{
    AllNodes = @(
        @{
            NodeName = '*'
            PSDSCAllowPlainTextPassword = $True
          }
    )

}

Configuration TestConfig{

    Import-DscResource -ModuleName @{ModuleName="xComputerManagement";ModuleVersion="1.3.0"}

    Node $AllNodes.Nodename{

        xComputer Test{
            Name = "MYPC"
        }

    }

}  

Under the very last curly brace there was a red squiggly line. When I tried to build the Configuration it failed with the error:

Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

It took me nearly an hour and a half to figure out what was causing the issue. Here is the working Configuration. Can you spot the difference?

$ConfigData =@{
    AllNodes = @(
        @{
            NodeName = '*'
            PSDSCAllowPlainTextPassword = $True
          }
    )

}

Configuration TestConfig{

    Import-DscResource -ModuleName @{ModuleName="xComputerManagement";ModuleVersion="1.3.0"}

    Node $AllNodes.NodeName {

        xComputer Test{
            Name = "MYPC"
        }

    }

}  

If you can’t spot the difference, the only difference is that in the second example, there is a space between $AllNodes.NodeName and the curly brace beginning the Node block. As you can imagine I have a serious problem with this, and believe this to be a bug. You will notice that I don’t need a space between the name of the Configuration and the curly brace, so why should I need a space after $AllNodes.NodeName? Also, in the next example, if I change $AllNodes.NodeName to Node MYPC, it doesn’t require a space between the node name and the curly brace either.

Configuration TestConfig{

    Import-DscResource -ModuleName @{ModuleName="xComputerManagement";ModuleVersion="1.3.0"}

    Node MYPC{

        xComputer Test{
            Name = "MYPC"
        }

    }

}  

All of this testing was done on Windows 10 Enterprise Preview edition with PowerShell Version 5.0.10158.0 . If you also believe this is a bug and should be fixed, vote up the issue on connect here.

WSUS 2012 Post Install Configuration Fails: Config File Did Not Contain A Value “Content Directory”

Installed the WSUS Server Role on Server 2012.  Installation completes successfully and it comes up with the post installation configuration wizard.  I click to start the wizard, and it fails immediately.  I open up the log file created and see the text below.

2013-08-12 14:17:06 Postinstall started
2013-08-12 14:17:06 Detected role services: Api, Database, UI, Services
2013-08-12 14:17:06 Start: LoadSettingsFromXml
2013-08-12 14:17:06 Start: GetConfigValue with filename=UpdateServices-Services.xml item=ContentLocal
2013-08-12 14:17:07 Value is true
2013-08-12 14:17:07 End: GetConfigValue
2013-08-12 14:17:07 Start: GetConfigValue with filename=UpdateServices-Services.xml item=ContentDirectory
2013-08-12 14:17:07 Config file did not contain a value “ContentDirectory”
2013-08-12 14:17:07 Microsoft.UpdateServices.Administration.CommandException: A required configuration value was not found in the system. This is usually caused by installing WSUS through PowerShell and not specifying a configuration file. Review the article Managing WSUS Using PowerShell at TechNet Library (http://go.microsoft.com/fwlink/?LinkId=235499) for more information on the recommended steps to perform WSUS installation using PowerShell.
at Microsoft.UpdateServices.Administration.PostInstall.GetConfigValue(String filename, String item)
at Microsoft.UpdateServices.Administration.PostInstall.LoadSettingsFromXml()
at Microsoft.UpdateServices.Administration.PostInstall.Initalize(Parameters parameters)
at Microsoft.UpdateServices.Administration.PostInstall.Execute(String[] arguments)
Fatal Error: A required configuration value was not found in the system. This is usually caused by installing WSUS through PowerShell and not specifying a configuration file. Review the article Managing WSUS Using PowerShell at TechNet Library (http://go.microsoft.com/fwlink/?LinkId=235499) for more information on the recommended steps to perform WSUS installation using PowerShell.

Well, that is strange.  During the installation process you specify the content directory, and although the Server Manager uses PowerShell cmdlets behind the scenes, I didn’t do the installation using the PowerShell.  I did some googling and came up with nothing, so on a hunch I just launched the WSUS console.  Well, that’s interesting, its asking for the content directory and the DB instance again.  I filled in the correct settings, clicked run, and a few minutes later the configuration was finished.  I verified this by opening up SQL Management Studio and seeing that the SUSDB had been created.

Migrating WSUS From Server 2003 to Server 2012

List of supported Operating System’s and migration scenarios is listed here.  In my case I am going to migrating a WSUS deployment from Server 2008 R2 running SQL 2005 to Server 2012 Standard with SQL 2008 R2 SP1.

Review considerations and system requirements can be found here.

First step is to install and configure the OS according to your organization’s standards (including updates).  Second step is to install SQL 2008 R2 with SP1.

After launching Setup from the .ISO file I got the error below.  Select Run the program without getting help.

SQLError

Of course, then I just got the error below.  Back to the drawing board!  Open up Server Manager and install the .NET Framework 3.5 Feature Role using your Windows installation media.

.NETError

Open up Server Manager and install the .NET Framework 3.5 Feature Role using your Windows installation media.  You may need to specify an alternate location (which is just really your CD-ROM path).  Mine was D:SourcesSxS

After that is done re-launch the setup and install SQL Server.  I am not going to go through all the steps here, the only pieces I installed were the Database Engine and the Management Tools.  Then apply SP1 to the SQL Installation.

While SP1 is downloading/installing go through the Preparing for Migration documentation here, including filling out the worksheet for the existing WSUS server.

Now, for the actual migration we are just going to be following the steps listed here.

In my situation I am migrating from a WSUS Installation on Windows Server 2003 x86 (Source Server) to Windows Server 2012 x64 (Destination Server).   First step is to install the Windows Server Migration Tools on my destination server using the PowerShell command below.

Import-Module ServerManager
Add-WindowsFeature Migration

After that you need to create a folder containing those migration tools to use on your source server following the instructions here.  Make sure you get the create command to match your Source WSUS Server.  In my case the command looked like this:

.SmigDeploy.exe /package /architecture x86 /os WS03 /path C:WindowsServerMigration

Next, open the C:WindowsServerMigration folder you just created.  You should see a folder named similarly to mine which was SMT_ws03_x86.  Copy this folder to your Source Server.  Next, open a command prompt or PowerShell and change the directory to where you placed the folder above.  In my case it was C:SMT_WS03_x86 and run the following command to register Windows Server Migration Tools:

.Smigdeploy.exe

Next step is to migrate WSUS Update Binaries from the Source Server to the Destination Server, instructions for which can be found here.  For some reason the instructions aren’t in the original article, I had to click through about 7 different TechNet articles to find these steps.

On your DestinationServer open Windows Server Migration Tools (as administrator) and run the command below:

Receive-SmigServerData

Make sure to specify a password you can remember!

On your SourceServer open Windows Server Migration Tools (as administrator) and run the command below:

Send-SmigServerData -ComputerName <DestinationServer> -SourcePath <source_path> -DestinationPath <destination_path> -Include All -Force -Recurse

In my case my Source Path was just D:WSUSWsusContent and my Destination Path was the same.  You don’t need to create the folder structure on the Destination Server, the Migration Tool will complete that for you.

While that runs your Source and Destination Servers will look like this:

DestinationWSUS SourceWSUS

You can also check on the progress of the migration by comparing the contents of the WSUSWsusContent folder on the Source and Destination Servers to see how much has copied over.  This is a screenshot of my Destination Server after about 15 minutes of migration.

WSUSProgress