When you are installing or reinstalling Windows Server Update Services on a Windows Server 2012 machine, the WSUS post-deployment configuration tasks will sometimes fail.
Check the logs in C:\User\<username>\AppData\Temp\, and if the last line before the WSUS configuration failure states: “System.Data.SqlClient.SqlException (0x80131904): Changes to the state or options of database ‘SUSDB’ cannot be made at this time. The database is in single-user mode, and a user is currently connected to it. ALTER DATABASE statement failed” then you should prepare to remove the WSUS role, its associated features, and the database. Of course, you should backup your previous database, especially if this is a machine in production.
This is a snippet of the error that I kept getting in my logs:
2015-05-26 21:17:16 Configuring WID database... 2015-05-26 21:17:16 Configuring the database... 2015-05-26 21:17:19 Establishing DB connection... 2015-05-26 21:17:20 Checking to see if database exists... 2015-05-26 21:17:29 Database exists 2015-05-26 21:17:29 Switching database to single user mode... 2015-05-26 21:17:40 System.Data.SqlClient.SqlException (0x80131904): Changes to the state or options of database 'SUSDB' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it. ALTER DATABASE statement failed. at Microsoft.UpdateServices.DatabaseAccess.DBConnection.DrainObsoleteConnections(SqlException e) at Microsoft.UpdateServices.DatabaseAccess.DBConnection.ExecuteCommandNoResult() at Microsoft.UpdateServices.Administration.ConfigureDB.ConnectToDB() at Microsoft.UpdateServices.Administration.ConfigureDB.Configure() at Microsoft.UpdateServices.Administration.PostInstall.Run() at Microsoft.UpdateServices.Administration.PostInstall.Execute(String[] arguments) ClientConnectionId:7c63a033-0472-4602-95ae-e1c80298bf92 Fatal Error: Changes to the state or options of database 'SUSDB' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it. ALTER DATABASE statement failed.
1. Remove Windows Server Update Services
You will need to remove Windows Server Update Services, WID Database, and WSUS Services from the Server Roles. You will also need to remove the Windows Internal Database from the Features.
2. Delete the C:\Windows\WID folder
Unfortunately, removing the Windows Internal Database feature does not remove the actual database. You should back up this database if necessary, then delete the C:\Windows\WID folder
3. Re-install WSUS Role using a Local Admin account
Some have had success reinstalling it as a Domain Admin, however I have had mixed results. But I have never had an issue installing WSUS using a Local Admin account, so I recommend it to anyone who is still having issues installing WSUS and getting through the post-deployment configuration.
Let me know if this works for you or if you run into any other issues with your WSUS deployment.