Fixing Windows 2012 R2 server “Please wait” problem

Situation: the client has a Windows 2012 R2 server as VM om Hyper-V. Whenever they restart the server, it shows “Please wait” for two hours. We have double checked the DNS and make sure it is correct.

Troubleshooting: 1. Try safe mode for a test. If it works, check suspected software or services. Enable them one by one.

2. It could be the Windows update. Some people report KB3159398 may cuse the similar problem/

3. One of our friends send this one to us:

I’m seeing this with a 2012 R2 VM. Before I tried rebooting it a user complained that they couldn’t remote desktop to it and checking which users have permission to remote desktop I noticed SIDs from another domain not resolving. Rebooting makes no difference and I can’t get it to boot into SafeMode because by the time the Hyper-V console has connected it’s gone past the stage where you can get the prompt.
When it’s stuck on the Please Wait screen I can’t ping it so I can’t connect  event log to it to see what’s happening. Any ideas appreciated.

Edit: Found that you now need to press shift+F8 to get into safe mode. Once there I found I had event ID 5721
session setup for the domain failed because the domain controller did not have an account needed to setup the session by this computer

The WER fix made no difference for me and I resolved it by rejoining it to the domain.

However, we haven’t tested it.

4. Other person sends us this resolution, which fixes the problem:

Paul6790 Jun 27, 2016 at 1:26 PM

First of all apologies for the delay in response. I completely forgot I posted in this forum and my emails I realized get caught up at our LEA Spam service.
As such we have not found the cause or a permanent solution but I have managed to replicate the issue by simulating a powercut or an annoying student/teacher holding the power button because some numpty locks the computer and leaves it.
From my finding I read something about the WBEM repository becoming corrupt and it attempts to repair itself during startup.
So I originally tried repairing the repository which took ages then I read something about just renaming the repository and restarting the service which essentially builds a new repository so I wrote this script see below. (wbem.cmd)
Basically this script first attempts to stop 4/5 services and then loops to check that the ccmexec service has stopped as this is essential to delete the repository.
when ccmexec is in a stopped state it will delete the repository then restart the computer in 1 min. (you can adapt this to rename the repository folder if you wish but I have found no reason to keep the folder as it rebuild itself.)
I have never put it into a shutdown script for a number of reasons
• as of yet as it still has some administrator interaction requirements but this can be easily amended to become fully automated.
• doesnt always delete the repository as it thinks the files are sometime in use.
• the ccmexec service check can sometime fail to stop causing the script to go in to a never ending loop which you have to ctrl c out and start the script again
• I didn’t want the wbem repository deleted every night. only wanted to run it when the symptoms arose.
I have managed to get on top of it running it manually. I have trained the staff by sending periodic email about the importance of reporting computers that were Applying Computer Settings for more than 30 seconds. I would then remote on to that computer at the end of the day and run the script.
As the repository is getting corrupt there is nothing stopping it from corrupting again in the future so it is going to be a reoccurring maintenance. We go around checking ICT suites each holiday and applying the script to the symptomatic computers.
like I said feel free to adapt it if you want to fully automate it in a shutdown script but I would recommend manual deployment
I hope this helps people

EDIT Note I have removed this script as it was my first version and to avoid any confusion. I have adapted this script in a more recent comment dated 25th January 2017, 11:00 in this thread. Please see below and use that one thanks paul

Paul6790 Jan 25, 2017 at 5:00 AM

I have made a few amendments though to my script since but still manually deploy it when I need to.

I have added a failsafe to the script which only runs on the absence of a txt file in the root of c: 

I built this feature in just in case I want Group policy to manage the script but knowing that it will only action the script if I were to delete this txt file it looks for.

Other improvements includes Service status check for all dependent services and now has no admin interaction in script is required.

It is the closest I have got to automating completely but never really bothered testing within a group policy shutdown script. I cannot see why it wouldn’t work and the script is utilized to do so but the problem is not causing me that much of a problem at the moment to warrant creating a group policy for it.

I have shared my script below for people to use if you wish but please test it first.

Regards

Paul

@Echo off
If EXIST "c:\Wbem.txt" GOTO END
 
:BEGIN
Echo.Checking following services...
Echo IPHelper (iphlpsvc)
Echo SMS Agent Host (CcmExec)
Echo Security Centre (wscsvc) 
Echo Windows Management Instrumentation (winmgmt)
Echo.
 
Set Service1="ccmexec"
Set Service2="iphlpsvc" 
Set Service3="wscsvc" 
Set Service4="winmgmt"
 
:CHECK
for /F "tokens=3 delims=: " %%H in ('sc query %Service1% ^| findstr "        STATE"') do (
                     Set Service1State=%%H
                    if /I "%%H" NEQ "STOPPED" (
                                         echo.%Service1% still STOP_PENDING. Press Any key to check again otherwise Ctrl C out of the script
                                         net stop %Service1%
                                         timeout 10
                                         cls
                                         GOTO Check
                                         )
                    )
for /F "tokens=3 delims=: " %%H in ('sc query %Service2%  ^| findstr "        STATE"') do (
                     Set Service2State=%%H
                    if /I "%%H" NEQ "STOPPED" (
                                         echo.%Service2% still STOP_PENDING. Press Any key to check again otherwise Ctrl C out of the script
                                         net stop %Service2%
                                         timeout 10
                                         cls
                                         GOTO Check
                                         )
                    )
for /F "tokens=3 delims=: " %%H in ('sc query %Service3% ^| findstr "        STATE"') do (
                    Set Service3State=%%H
                    if /I "%%H" NEQ "STOPPED" (
                                         echo.%Service3% still STOP_PENDING. Press Any key to check again otherwise Ctrl C out of the script
                                         net stop %Service3%
                                         timeout 10
                                         cls
                                         GOTO Check
                                         )
                    )
for /F "tokens=3 delims=: " %%H in ('sc query %Service4% ^| findstr "        STATE"') do (
                    Set Service4State=%%H
                    if /I "%%H" NEQ "STOPPED" (
                                         echo.%Service4% still STOP_PENDING. Press Any key to check again otherwise Ctrl C out of the script
                                         net stop %Service4%
                                         timeout 10
                                         cls
                                         GOTO Check
                                         )
                    )
 
:STATUS
CLS
Echo.%Service1% is %Service1State%
Echo.%Service2% is %Service2State%
Echo.%Service3% is %Service3State%
Echo.%Service4% is %Service4State%
echo.
echo.All Services Stopped... Please Wait... Repairing WBEM Repository
del C:\Windows\System32\wbem\Repository\*.* /q
rd C:\Windows\System32\wbem\Repository* /q
timeout 5
cls
echo.Fix complete. Your computer will Restart in 60 seconds.
shutdown -r -t 60
echo.WBEM Script Control > c:\WBEM.txt
timeout 60
 
:END

Published by

Bob Lin

Bob Lin, Chicagotech-MVP, MCSE & CNE Data recovery, Windows OS Recovery, Networking, and Computer Troubleshooting on http://www.ChicagoTech.net How to Install and Configure Windows, VMware, Virtualization and Cisco on http://www.HowToNetworking.com

Leave a Reply