Installing WSUS on Windows Server “8” Beta using PowerShell

Installing WSUS on Windows Server “8” Beta using PowerShell

  • Comments 3
  • Likes


Travis Plunk, Software Developer Engineer
Yuri Diogenes, Senior Technical Writer

Technical Reviewers:

Cecilia Cole, Program Manager

In our previous post, we demonstrated how to install the WSUS Role on the Windows Server “8” Beta using the new Server Manager. In this post you will learn how to perform the same task using PowerShell.

To install WSUS on Windows Server “8” Beta using PowerShell, follow the steps below:

1. Sign in on Windows Server “8” Beta

2. On the taskbar click Windows PowerShell button.


3. In the PowerShell Console type Install-WindowsFeature -Name UpdateServices, UpdateServices-Ui and press ENTER.

4. The installation process will start and a progress counter will appear on the screen. Wait until the installation reaches 100% and you receive a message that the installation succeeded before moving on to the next step.

5. Type & ‘C:\Program Files\Update Services\Tools\WsusUtil.exe’ postinstall contentdir=C:\Mycontent and press ENTER.

6. Wait until you receive the message that the post installation successfully finished.

8. Type Exit and press ENTER to leave the PowerShell interface.

At this point the WSUS installation is completed and you may launch the WSUS Console using the Tools menu. When you launch WSUS for the first time the WSUS Configuration Wizard will appear. For more information about how to configure WSUS, read Step 3: Configure WSUS in the Deploying Windows Server Updates Services in the Organization article at the TechNet Library.

If you want to perform the full installation and post installation tasks using PowerShell you should run this script once you finish the installation via PowerShell.

Stay tuned for more exciting stuff on this blog and the Windows Server Blog from the server leadership team.

Yuri Diogenes | Senior Technical Writer

Get the latest System Center news on Facebook and Twitter:

clip_image001 clip_image002

App-V Team blog:
ConfigMgr Support Team blog:
DPM Team blog:
MED-V Team blog:
Orchestrator Support Team blog:
Operations Manager Team blog:
SCVMM Team blog:
Server App-V Team blog:
Service Manager Team blog:
System Center Essentials Team blog:
WSUS Support Team blog:

The Forefront Server Protection blog:
The Forefront Endpoint Security blog :
The Forefront Identity Manager blog :
The Forefront TMG blog:
The Forefront UAG blog:

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi, this way of installing is no longer working on Windows Server 2012 RTM. Here is a script that works for us:

    function Install-WSUS {





           $ContentDirectory = "C:\ProgramData\WSUS\Content"


       Install-WindowsFeature -Name updateservices -IncludeManagementTools

       # Modification of the UpdateServices-Services.xml

       # NOTE :

       # When the installation is made with the previous cmdlet "Install-WindowsFeature ..." and not with the ServerManager GUI the XML configuration file UpdateServices-Services.xml is not correctly set.

       # We need to set the value of the two properties : ContentDirectory and ContentLocal


       invoke-command -ScriptBlock {

         Write-Output "Configuring UpdateServices-Services with ContentLocal: $($ContentLocal), ContentDirectory: $($ContentDirectory)";

         $assemblyReferences=@("System.Xml", "System.Xml.Linq");


    using System;

    using System.IO;

    using System.Diagnostics;

    using System.Linq;

    using System.Xml.Linq;

    namespace CSharpScripts {

       public class UpdateServicesConfigurationV11 {

           public static string SetServicesProperties(bool contentLocal, string contentDirectory) {

               string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "ServerManager", "ComponentConfiguration", "UpdateServices-Services.xml");

               SetServicesProperties(path, contentLocal, contentDirectory);

               return path;


           public static void SetServicesProperties(string path, bool contentLocal, string contentDirectory) {

               XDocument doc;

               using(StreamReader reader = new StreamReader(path, true)) {

                   doc = System.Xml.Linq.XDocument.Load(reader);


               XElement instance = doc.Element("INSTANCE");

               if (instance.Attribute("CLASSNAME").Value != "ServerComponent_UpdateServices_Services") {

                   throw new InvalidOperationException("Bad file");


               foreach (XElement property in instance.Elements("PROPERTY")) {

                   switch (property.Attribute("NAME").Value) {

                       case "ContentDirectory":

                           SetPropertyValue(property, contentDirectory);


                       case "ContentLocal":

                           SetPropertyValue(property, contentLocal, toLower:true);






               //Workaround for access denied...

               string tempPath = Path.ChangeExtension(path, ".xml.tmp");



               File.Move(tempPath, path);


           private static void SetPropertyValue(XElement property, object value, bool toLower = false) {

               XElement valueElement;

               string stringValue = (value ?? string.Empty).ToString();

               if (toLower) {

                   stringValue = stringValue.ToLowerInvariant();


               if (property.Elements("VALUE").Count()>0) {

                   valueElement = property.Element("VALUE");

               } else {

                   valueElement = new XElement("VALUE");



               valueElement.Value = stringValue.ToString();





           Add-Type -ReferencedAssemblies $assemblyReferences -TypeDefinition $sourceCode -Language CSharp

           $configFile = [CSharpScripts.UpdateServicesConfigurationV11]::SetServicesProperties($ContentLocal, $ContentDirectory);

           Get-Content -Path $configFile;


         Write-Output "Launching Post installation of UpdateServices-Services";

       # Run post-installation by command line

       & 'C:\Program Files\Update Services\Tools\WsusUtil.exe' postinstall /sm