UPDATE: The Original post was done on May 1, 2014. I’ve added script code at the bottom of the post to accommodate issues that may be encountered with WID conflicts in Server 2012/ 2012R2. The PS Script code also works with Server 2016.
Not long ago, I was trying to re-install WSUS on a server that would not generate the ‘WSUS Administration’ website.
Post-installation tasks would also fail without giving me much to go on. After some time researching, I found several posts on message boards that all said to do different things to resolve the issue. Some of them even said to either reload the OS on the server (not always an option in a production environment), or call Microsoft for help (which as we all know costs $$$).
Here’s what I found…
In the installation log located in the %temp% folder there should be a log file with the .TMP file extension. (EXAMPLE: tmp56B7.tmp)
When looking at this file, it told me that a file it was looking for was not found, or corrupt.
When I ran the WSUS Console I saw the following:
___________________________________________________________________________
The WSUS administration console has encountered an unexpected error. This may be a transient error; try restarting the administration console. If this error persists,
Try removing the persisted preferences for the console by deleting the wsus file under %appdata%\Microsoft\MMC\.
The WSUS administration console has encountered an unexpected error. This may be a transient error; try restarting the administration console. If this error persists,
Try removing the persisted preferences for the console by deleting the wsus file under %appdata%\Microsoft\MMC\.
System.NullReferenceException — Object reference not set to an instance of an object.
Source
Microsoft.UpdateServices.UI.AdminApiAccess
Stack Trace:
at Microsoft.UpdateServices.UI.AdminApiAccess.AdminApiTools.GetLocalInstallDir()
at Microsoft.UpdateServices.UI.AdminApiAccess.Constants..cctor()
** this exception was nested inside of the following exception **
System.TypeInitializationException — The type initializer for ‘Microsoft.UpdateServices.UI.AdminApiAccess.Constants’ threw an exception.
Source
Microsoft.UpdateServices.UI.SnapIn
Stack Trace:
at Microsoft.UpdateServices.UI.SnapIn.Scope.RootScopeNode.GetComputerTargetFromCmdLine()
at Microsoft.UpdateServices.UI.SnapIn.Scope.RootScopeNode.AddServerScopeNodeFromCmdLine()
at Microsoft.UpdateServices.UI.SnapIn.Common.SnapInManager.OnLoadCustomData(AsyncStatus status, Byte[] persistenceData)
___________________________________________________________________________
To resolve the issue, I performed the following steps (in order):
1) Open a PowerShell session as Administrator and uninstall WSUS completely with the following command:
Remove-WindowsFeature –Name UpdateServices,UpdateServices-DB,UpdateServices-RSAT,UpdateServices-API,UpdateServices-UI –IncludeManagementTools
2) Delete the registry key HKLM\SOFTWARE\Microsoft\Update Services
3) Delete the WSUS file from %appdata%\Microsoft\MMC
4) Delete the Folder %ProgramFiles%\Update Services along with all of its subfolders and files.
5) Reboot the server
6) Run the System File Checker to find and repair any inconsistencies by typing the command below into the PowerShell prompt.
SFC /scannow
7) Reboot the server
8) Verify IIS is installed and working without errors
9) Open a Powershell session as Administrator an install WSUS with the following command:
To use a SQL DB:
Install-WindowsFeature –Name UpdateServices,UpdateServices-DB -IncludeManagementTools
To use WID:
Install-WindowsFeature –Name UpdateServices –IncludeManagementTools
10) Once WSUS installation has completed, change the current working directory to %programfiles%\Update Services\Tools and run one of the following post-installation commands:
To use a SQL DB:
.\wsusutil.exe postinstall SQL_INSTANCE_NAME=”SERVER\Instance” CONTENT_DIR=”:\WSUS”
To use WID:
.\wsusutil.exe postinstall CONTENT_DIR=”:\WSUS”
11) Wait for the command to complete successfully.
12) If you are using this WSUS instance as part of a farm, then open the Admin Console and configure your updates.
13) If you are using this instance as part of the roles within an SCCM Implementation, open the SCCM Console and install the Software Update point role.
Here is my PowerShell Script code to perform the WSUS Installation and Post-Installation tasks. Copy the code and save it as a .PS1 script file and run it on the intended Server.
For use with SQL Server:
# Usage: # For named SQL Instances - # .Install-WSUS.ps1 -SQLInstance "SQLservername\InstanceName" -ContentDir "DriveLetter:\FolderName" # # For Default SQL Instance - # .Install-WSUS.ps1 -SQLInstance "SQLservername" -ContentDir "DriveLetter:\FolderName" Param( [Parameter(Mandatory=$True)][String]$SQLInstance, [Parameter(Mandatory=$True)][String]$ContentDir ) Install-WindowsFeature -Name UpdateServices -Verbose Remove-WindowsFeature UpdateServices-WidDb -Verbose Install-WindowsFeature -Name UpdateServices-DB -Verbose Install-WindowsFeature -Name UpdateServices-UI -Verbose Start-Process -FilePath "$($env:ProgramFiles)\Update Services\Tools\wsusutil.exe" -ArgumentList "postinstall SQL_INSTANCE_NAME=$($SQLInstance) CONTENT_DIR=$($ContentDir)" -Verbose -Wait
For use with Windows Internal Database:
# Usage: # .Install-WSUS.ps1 -ContentDir "DriveLetter:\FolderName" Param( [Parameter(Mandatory=$True)][String]$SQLInstance, [Parameter(Mandatory=$True)][String]$ContentDir ) Install-WindowsFeature -Name UpdateServices -Verbose Install-WindowsFeature -Name UpdateServices-UI -Verbose Start-Process -FilePath "$($env:ProgramFiles)\Update Services\Tools\wsusutil.exe" -ArgumentList "postinstall CONTENT_DIR=$($ContentDir)" -Verbose -Wait
Configure WSUS as needed and happy patching!
Install-WindowsFeature –Name UpdateServices,UpdateServices-DB -IncludeManagementTools gives me the following error:
1. Feature WID Database has a conflict with the features Database.
2. Feature Database has a conflict with the features WID Database.
At line:1 char:1
LikeLike
I have an updated script to install WSUS that I will be posting soon. It uninstalls the roles and features, then removes WID, then installs DB. For some reason MS seems to have changed the installation logic and rules with an update for Server 2012/ 2012 R2 somewhere along the line.
LikeLike
I added the code at the end of the posting. Let me know if it works for you. Sorry it took so long for me to reply.
LikeLike
Thanks man, this worked great. I was just about to reinstall the OS the I saw your post. Nice work.
LikeLike
great…saved me from formatting the server.
LikeLike
OMG…this resolved my issue. I’ve been fighting w/this for far too long.
LikeLike
Happy to help!
LikeLike
Great article! been battling with WSUS 3.0 for ages!
LikeLike
Thanks so much, you have saved me another format.
LikeLike
Happy to be of assistance!
LikeLike
I think the space between UpdateServices, and UpdateServices-DB in the command
Install-WindowsFeature –Name UpdateServices, UpdateServices-DB -IncludeManagementTools
has to be removed. Before removing it it was giving the errors
Feature WID Database has a conflict with the features Database.
Feature Database has a conflict with the features WID Database.
JP
LikeLike
I removed the space within the article. Thanks!
LikeLike