none
Silent Activation Windows 7 with MDT RRS feed

  • Question

  • Hi all,

    Actually I use this bat file in MDT to activate my deployments : 

    slmgr -ipk $$$$$$$$$$$$$$$$$$$$$$$$
    timeout /t 10
    slmgr -ato

    But two windows appears, and I need to clik "OK".

    Is a solution to don't have windows ? 

    Thanks,

    Thursday, September 8, 2016 1:07 PM

Answers

  • I dug up an old batch I used to use. I never had a window requiring interaction come up.

    REM ************************************************************
    REM * Apply the Microsoft Windows MAK and activate the license *
    REM ************************************************************
    :WinAct
    REM Check Windows Version
    ver | findstr /i "6\.1\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win7
    ver | findstr /i "6\.2\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win8
    ver | findstr /i "6\.3\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win81
    goto warn_and_exit
    
    :ver_Win7
    :Run Windows 7 specific commands here
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    goto end
    
    :ver_Win8
    :Run Windows 8 specific commands here
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    goto end
    
    :ver_Win81
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    
    goto end
    
    :warn_and_exit
    echo Machine OS cannot be determined. License has not been activated
    
    :End
    exit


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, September 8, 2016 2:45 PM
  • Easiest way is to just add a step in the task sequence:

    cscript c:\windows\system32\slmgr.vbs /ato

    Thursday, September 8, 2016 7:22 PM

All replies

  • I dug up an old batch I used to use. I never had a window requiring interaction come up.

    REM ************************************************************
    REM * Apply the Microsoft Windows MAK and activate the license *
    REM ************************************************************
    :WinAct
    REM Check Windows Version
    ver | findstr /i "6\.1\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win7
    ver | findstr /i "6\.2\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win8
    ver | findstr /i "6\.3\." > nul
    IF %ERRORLEVEL% EQU 0 goto ver_Win81
    goto warn_and_exit
    
    :ver_Win7
    :Run Windows 7 specific commands here
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    goto end
    
    :ver_Win8
    :Run Windows 8 specific commands here
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    goto end
    
    :ver_Win81
    cscript %windir%\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    NET STOP "SOFTWARE PROTECTION"
    NET START "SOFTWARE PROTECTION"
    cscript %windir%\system32\slmgr.vbs /ato
    
    goto end
    
    :warn_and_exit
    echo Machine OS cannot be determined. License has not been activated
    
    :End
    exit


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, September 8, 2016 2:45 PM
  • If it makes it easier, I always activate Windows in my unattend.xml answer file.
    In 7 oobeSystem, in
    amd64_Microsoft_Windows-Shell-Setup_neutral, under FirstLogonCommands, I add SynchronousCommand#2 which is: cscript //b c:\windows\system32\slmgr.vbs / ipk XXXX-XXXX.....
    What this does is stores the activation key into Windows.

    Then I add one more Command, SynchronousCommand#3 and on its command line I add:
    cscript //b c:\windows\system32\slmgr.vbs /ato
    What this does is tells the unit to go out and autoactivate if the account has permissions to do so. I've used this since day one and every machine activates by itself before it gets to the desktop. No intervention if you change
    RequiresUserInput to false on both #2 and #3 lines.



    • Edited by the1rickster Thursday, September 8, 2016 6:19 PM more info
    Thursday, September 8, 2016 6:16 PM
  • Hello Dechaseaux,

    I think the key here is to use cscript to run the commands as it runs all commands entirely in the command line:

    http://ss64.com/vb/cscript.html

    You can even add a run command line task as a task sequence step to avoid using a batch file entirely.

    ~ DLofstedt

    Thursday, September 8, 2016 7:08 PM
  • Easiest way is to just add a step in the task sequence:

    cscript c:\windows\system32\slmgr.vbs /ato

    Thursday, September 8, 2016 7:22 PM
  • Thanks all to your help.

    It's working with the script and with the command line. 

    Friday, September 9, 2016 1:21 PM