Reboot made by wmiprvse.exe during first boot after sysprep
-
Hello,
I run cmd script called from the unattend.xml of Windows sysprep.
This script makes a 60s break to wait network to start then run SDI (Snappy Driver Installer) that works perfectly when run manually.
During the script process, i have a reboot requested by wmiprvse.exe (WMI Provider Host).
This happen during the 60s, or during driver installation when i remove the 60s delay.
I have run SAD (Stand Alone Driverpack) for a year using the same way without any reboot during the process.The only change made are that i was running SAD directly in the unattend.xml but now i call a cmd to run SDI.
Does anyone have idea why I have this reboot, if i can avoid it or if i have made a stupid mistake somewhere ?
Thank you.
Here is all the details i can provide.
Content of unattend.xml
<FirstLogonCommands> <SynchronousCommand wcm:action="add"> <CommandLine>C:\SDI.cmd</CommandLine> <Order>1</Order> <RequiresUserInput>true</RequiresUserInput> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <CommandLine>cmd /c del C:\SDI.cmd</CommandLine> <Order>2</Order> <RequiresUserInput>true</RequiresUserInput> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <CommandLine>cmd /c rmdir C:\Users\Administrateur\Desktop\sysprep /s /q</CommandLine> <Order>3</Order> <RequiresUserInput>true</RequiresUserInput> </SynchronousCommand> </FirstLogonCommands>
The cmd script
@echo off echo %date% %time% Fichier de log cree >> C:\imageresults.txt 2>&1 echo %date% %time% Demarrage du script >> C:\imageresults.txt 2>&1 echo %date% %time% Attente de 60 secondes pour activation du LAN >> C:\imageresults.txt 2>&1 timeout /t 60 /nobreak >> C:\imageresults.txt 2>&1 echo %date% %time% Montage du partage samba de fog >> C:\imageresults.txt 2>&1 NET USE z: \\fogserver\Drivers Z: if not %cd% == Z:\ goto nofog echo %date% %time% Installation drivers via SDI >> C:\imageresults.txt 2>&1 FOR /F "tokens=*" %%G IN ('DIR /B *.exe') do start /wait %%G -autoinstall -nologfile -autoclose -license C: NET USE /delete /yes Z: :nofog ::echo %date% %time% Activation Windows >> C:\imageresults.txt 2>&1 ::cscript C:\Windows\system32\slmgr.vbs /ato >> C:\imageresults.txt 2>&1 shutdown -r -t 30 exit
-
your CMD script.
I added output to the part that installs the drivers. Perhaps it might give clues?
[CODE]@echo off
echo %date% %time% Fichier de log cree >> C:\imageresults.txt 2>&1
echo %date% %time% Demarrage du script >> C:\imageresults.txt 2>&1
echo %date% %time% Attente de 60 secondes pour activation du LAN >> C:\imageresults.txt 2>&1
timeout /t 60 /nobreak >> C:\imageresults.txt 2>&1
echo %date% %time% Montage du partage samba de fog >> C:\imageresults.txt 2>&1
NET USE z: \fogserver\Drivers
Z:
if not %cd% == Z:\ goto nofog
echo %date% %time% Installation drivers via SDI >> C:\imageresults.txt 2>&1
FOR /F “tokens=*” %%G IN (‘DIR /B *.exe’) do start /wait %%G -autoinstall -nologfile -autoclose -license >> C:\DriverInstallOutput.txt
NET USE /delete /yes Z:
:nofog
::echo %date% %time% Activation Windows >> C:\imageresults.txt 2>&1
::cscript C:\Windows\system32\slmgr.vbs /ato >> C:\imageresults.txt 2>&1
shutdown -r -t 30
exit[/CODE] -
Thank you for your reply.
I’m sure drivers install is not related to the reboot problem because, as i said, the timeout command is stopped before the 60 second.
I’ll repeat in case i wasn’t clear :
- Case 1 with the timeout command : countdown is stopped before reaching 0.
- Case 2 without the timeout command : SDI is forced to closed during install.
I have tested most of the posibilities possible during few days (this script was in setupcomplete.cmd at first) such as removing the timeout command, reducing it, adding or removing some “start /wait” or “cmd /c” in the xml.
I ended adding the %time% and the %date% to check system event and i see clearly a message saying that “wmiprvse.exe has initiated the restart of computer” but there is no more details.I start to think that the computer doesn’t see that there is a script running so here my last test left, just set a “pause”.
-
I have just make a test with only a “pause” in the script and there is no unwanted reboot.
-
Can you post your new script?
-
When i say only pause, it’s only a pause
pause
lol
-
@jmeyer said:
shutdown -r -t 30
that part causes a reboot… just clarifying… didn’t know if you knew or not.
-
Reboot appears during
timeout /t 60 /nobreak
-
Can you remove the shutdown -r -t 30 and just see what happens?
-
I did but the script never reach this line as it’s forced to stop for the reboot during the 60 seconds of the timeout command.
I know you’ll look for basic reason but I have tested so many things that I’m out of idea.
-
Are there alternatives for wmiprvse.exe ?
-
What do you mean ?
-
@jmeyer said:
During the script process, i have a reboot requested by wmiprvse.exe (WMI Provider Host).
This happen during the 60s, or during driver installation when i remove the 60s delay.You said you think this is what’s causing your reboot. I was wondering if there were any alternatives that may give you less trouble.
-
Since I don’t know what trigger this reboot, I don’t even know where to start to dodge this reboot.
I don’t know if there is other way to run a script after a sysprep.
I only know with the setupcomplete.cmd or adding call of commands in the unattend.xml. -
Is the fog client use this exe to reboot the computer ?
Thomas use kinda the same script without problem but disable the fog service and that the only thing that I see that could explain a reboot.
Yet, i don’t see what a simple “pause” can change from a “timeout” to avoid this reboot.I’ll test again with fog service disabled or the client remove to find if it comes from the fog client.
I can also try with a fresh OS install in case Windows Update did something. -
@jmeyer What were your findings?
-
I have called for help from a old fellow worker.
He as said to try to replace the “timeout” command by a “ping 127.0.0.1”.
But, I think i have find a way to avoid this reboot during the script process.
I call my script in the unattend.xml like this “cmd /c start /wait Myscript.cmd”.
I wasn’t on site and I wanted to test it in the same condition (with the same fog server) in case it’s the fog client that makes this unwanted reboot (it’s Tom Elliott only idea to my problem).
I run few last test today and i keep you update. -
My script launch edition didn’t solved the problem.
I try again with fog service disabled. -
I realize this is a few months old thread, jmeyer did you ever get it to work?
I am presently trying pretty much the same.
Did you ever succeed?
-
@FlowLive
It was fog client that was calling the reboot.
I just disable it before sysprep and enable it in script.I set most of it in a script in a smb share called by SetupComplete.cmd to not have to edit my image but be able to enhance it.
It works great and I use this script to do the most of task needed after deploy : drivers, windows activation and few basic software installation.
I even tested and validated it under Windows 10 few days ago.Days of work that finally pay back.
SetupComplete.cmd
@echo off echo %date% %time% Demarrage du script SetupComplete >> C:\imageresults.txt 2>&1 del /Q /F %windir%\system32\sysprep\unattend.xml >> C:\imageresults.txt 2>&1 del /Q /F %windir%\panther\unattend.xml >> C:\imageresults.txt 2>&1 echo %date% %time% Attente de 60 secondes pour activation du LAN >> C:\imageresults.txt 2>&1 timeout /t 60 /nobreak >> C:\imageresults.txt 2>&1 echo %date% %time% Fin des 60s >> C:\imageresults.txt 2>&1 echo %date% %time% Montage du partage samba de fog >> C:\imageresults.txt 2>&1 NET USE z: \\fogserver\AfterDeploy echo %date% %time% Net use effectué >> C:\imageresults.txt 2>&1 Z: if not %cd% == Z:\ goto nofog echo %date% %time% Dossier actuel %cd% >> C:\imageresults.txt 2>&1 echo %date% %time% Chargement du script AfterDeploy >> C:\imageresults.txt 2>&1 start /wait AfterDeploy.cmd C: NET USE /delete /yes Z: echo %date% %time% Lecteur Z demonte >> C:\imageresults.txt 2>&1 :nofog ::echo %date% %time% Activation Windows >> C:\imageresults.txt 2>&1 ::cscript C:\Windows\system32\slmgr.vbs /ato >> C:\imageresults.txt 2>&1 echo Activation du service FOG en demarrage automatique >> C:\imageresults.txt sc config "FOG Service" start= auto >> C:\imageresults.txt 2>&1 net start "FOG Service" >> C:\imageresults.txt 2>&1 shutdown -r -t 30 echo %date% %time% Reboot >> C:\imageresults.txt 2>&1 exit
AfterDeploy.cmd
echo %date% %time% - Script AfterDeploy - Changement de dossier : %cd% >> C:\imageresults.txt 2>&1 cd /SDI echo %date% %time% - Script AfterDeploy - Lancement de SDI >> C:\imageresults.txt 2>&1 IF %cd% == Z:\SDI start /wait SDI_auto.bat -autoinstall -nologfile -autoclose -license echo %date% %time% - Script AfterDeploy - Fin script SDI >> C:\imageresults.txt 2>&1 cd .. cd /ActivationWin7 echo %date% %time% - Script AfterDeploy - Lancement de Activation OEM Windows >> C:\imageresults.txt 2>&1 cscript ActivationWin7.vbs echo %date% %time% - Script AfterDeploy - Fin script activation >> C:\imageresults.txt 2>&1 cd .. echo %date% %time% - Script AfterDeploy - Modification pour désactiver AutoAdminLogon REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f echo %date% %time% - Script AfterDeploy - Modification registre effectuée cd /Logiciels echo %date% %time% - Script AfterDeploy - Lancement Install logiciels>> C:\imageresults.txt 2>&1 cscript Logiciels.vbs echo %date% %time% - Script AfterDeploy - Fin Install logiciels >> C:\imageresults.txt 2>&1 cd .. cd /IACA echo %date% %time% - Script AfterDeploy - Lancement de Auto Install IACA >> C:\imageresults.txt 2>&1 Auto_Install_Client.exe /NOREBOOT /YES /AM=N echo %date% %time% - Script AfterDeploy - Fin Auto Install IACA >> C:\imageresults.txt 2>&1 cd .. echo %date% %time% - Script AfterDeploy - Fermeture de script AfterDeploy.cmd >> C:\imageresults.txt 2>&1 exit