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
    


  • @jmeyer

    Thanks jmeyer this works great!



  • @FlowLive
    I think you are right about the start /wait of the cmd.
    But I have this on the .bat of SDI :

     start /wait "Snappy Driver Installer" /d"%~dp0" "%~dp0%SDIEXE%" %1 %2 %3 %4 %5 %6 %7 %8 %9
    

    The web access of SDI is to check driver packages update.
    Fog service name depend of the version you use on the OS of the image you are going to make.



  • @jmeyer

    Hi @jmeyer,

    I have a question, I am trying this script now, the problem I have is your AfterDeploy.cmd you have set a start /wait SDI_auto.bat but since that closes after it successfully called the .exe the script goes on without having a chance to finish SDI install of drivers…

    Are you sure this is how you have it?

    I am also getting a prompt for firewall access to let SDI through on launch of the .exe, have you had that happen?

    I am also running those script from \fogserver\share…

    I see you had a previous version that called the .exe directly which from my understanding would have actually /wait succesfully until completion, or did you alter the SDI_auto.bat somehow to have another /wait in there is at all possible?

    I see that my service is FOGService and not FOG Service, had to change that…

    Thanks! Love your script!



  • @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
    


  • 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?



  • My script launch edition didn’t solved the problem.
    I try again with fog service disabled.



  • 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.


  • Moderator

    @jmeyer What were your findings?



  • 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.



  • 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.


  • Moderator

    @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.



  • What do you mean ?


  • Moderator

    Are there alternatives for wmiprvse.exe ?



  • 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.


  • Moderator

    Can you remove the shutdown -r -t 30 and just see what happens?



  • Reboot appears during

    timeout /t 60 /nobreak 
    

  • Moderator

    @jmeyer said:

    shutdown -r -t 30

    that part causes a reboot… just clarifying… didn’t know if you knew or not.



  • When i say only pause, it’s only a pause

    pause
    

    lol


  • Moderator

    @jmeyer

    Can you post your new script?


Log in to reply
 

471
Online

39.3k
Users

11.0k
Topics

104.5k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.