Installing Windows Server Update Services on Windows Server 2012 with PowerShell
Warning! Out of date content.
I will describe how to install a Windows Server Update Services (WSUS) on W2012 using powershell.
Some notes:
- This will be an autonomous installation which will fetch updates directly from Microsoft Update;
- The database will be the default Windows Internal Database called SUSDB located in C:\Windows\WID\Data.
First install the Windows Update Services Role and the management console:
Install-WindowsFeature UpdateServices,UpdateServices-UI
The result should be similar to below:
PS C:\Users\administrator.HOMELAB> Install-WindowsFeature UpdateServices,UpdateServices-UI
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Remote Server Administration Tools, Role ...
WARNING: Additional configuration may be required. 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.
After installing the WSUS Role The ServerManager will show a notification about post-deployment configuration. Performing this configuration will fail. A solution is to use WsusUtil to perform a post-install:
& 'C:\Program Files\Update Services\Tools\WsusUtil.exe' postinstall CONTENT_DIR=D:\WSUS\
Point CONTENT_DIR to your location of choice. This is where all the downloaded files and associated data will be stored.
Running the post-install will result in output similar to:
PS C:\Users\administrator.HOMELAB> & 'C:\Program Files\Update Services\Tools\WsusUtil.exe' postinstall CONTENT_DIR=D:\WSUS\
Log file is located at C:\Users\administrator.HOMELAB\AppData\Local\Temp\2\tmpEEA3.tmp
Post install is starting
Post install has successfully completed
PS C:\Users\administrator.HOMELAB
Now you can start the Windows Server Update Services console and step through the Configuration Wizard. Note: In my case the WSUS server needed a restart before it was be able to synchronise information about available updates.
In this (single server) scenario using powershell does not provide any real benefits.
Sources and additional reading material: