Monday, 20 January 2014

[CMD] Safe to Rearm Script Windows 7, Server 2008 R2

Rearm to extend up to 50 days more
Assalamualaikom w.b.t

After prepared about 25 desktop with windows server 2008 R2, i need a simple batch command that can exteding the trial version without wasting available rearm count. In windows 7 and windows server 2008 r2, we can rearm or extend the trial days five times with 10 days each by execute this command in command prompt:

slmgr.vbs /rearm

However if we execute multiple times, the remaining rearm count will decreased and overwrites and lastly will left to zero. This will wasting our remaining rearm availability that should be execute after each 10 days trial for five times.

Execte slmgr.vbs /dlv to view remainign time and rearm count


Then, i got an idea to create simple basic tool using batch command that can rearm without worrying about its still under trial days. This script will rearm if our trial lest than 8 hours to become expired.

Here you go:

@echo off
cls
mode con: cols=65 lines=15
:START
echo. ---- Safe Autorearm build to avoid wasting remaining rearm ----
echo.         Created by myskali.blogspot.com
echo.               Associate Technical Services
echo.               last updated 14 January 2014
echo.
echo. Finding available minutes...
echo.

for /f "tokens=3" %%a in ('cscript.exe %windir%\system32\slmgr.vbs /dlv ^| FINDSTR /i /c:"Notification Reason"') do goto REARM

for /f "tokens=3" %%a in ('cscript.exe %windir%\system32\slmgr.vbs /dlv ^| FINDSTR /i /c:"Time Remaining"') do set dtime=%%a


echo.
echo. ++   Minutes remaining is %dtime%   ++


if %dtime% GEQ 500 goto BANYAK
goto REARM



:BANYAK
echo.
echo.
echo. Your current rearm still have much time to be used!
echo.
echo.
goto EXIT

:REARM
echo.
echo.
echo+
cscript.exe %windir%\system32\slmgr.vbs /rearm
IF ERRORLEVEL 1 pause & goto START
shutdown /r /t 30 /C "Windows will restart in 30 seconds..."
echo+
goto EXIT

:EXIT
pause
exit


Copy above command and save as saferearm.bat and ready to use.



No comments:

Post a Comment