I regularly do a restore from disk image created by Win10 with (Backup and Restore - Windows7) by booting with Win10 recovery usb. And sometimes this installation loses its activation, complaining about incorrect profile/cannot contact activation servers, etc. Well I have created a crude script that I ran for 4 hours and it eventually got the installation activated again :loop cscript /nologo slmgr.vbs /ato echo Trying... timeout 5 goto loop You need to save this as .cmd file and run it as Admin. it will try to automatically activate windows every 5 seconds. I know this script can be made much better, but it worked for me so hopefully it will help someone else out there as well.
What does it actually use to activate? HWID activation normally is instantly or takes a few minutes and a reboot to activate, why should you run any script? KMS activation is always instant.
The problem is that for some Win10 users clicking on activate windows complains about incorrect profile/cannot contact activation servers and lot of users reported clicking the activate button hundreds of times it eventually activated. So the script above is an infinite loop doing the manual clicking above every 5 seconds. I rather have a script doing this then to click hundreds of times. It helped me activate windows after running for about 4 hours.
In your case Windows would have activated on it's own whenever the activation server became available. Anyway, I've added an exit for your batch with a msgbox: Code: @echo off if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit :loop for /f "tokens=3 delims=: " %%a in ( 'cscript //nologo "%systemroot%\system32\slmgr.vbs" /dli ^| find "License Status:"' ) do set "licenseStatus=%%a" if /i "%licenseStatus%"=="Licensed" ( echo msgbox "Windows 10 has been Activated" > %tmp%\tmp.vbs cscript /nologo %tmp%\tmp.vbs del %tmp%\tmp.vbs ) else ( cscript /nologo slmgr.vbs /ato echo Trying... timeout 5 goto loop )