Hi Everyone,
Starting to use One2Many more and more for automated tasks but found that the restart command a little limited especially if you manage multiple version of Windows.
Here is an updated version that might be of interest: -
@echo off
rem =====================================================================================================
rem = Company: Strobe Technologies Ltd T/a Strobe IT
rem = Author: Robin Toy
rem = Version: v 1.2
rem = Date: 25/01/2014
rem ======================================================================================================
rem = Description:
rem = LogMeIn One2Many Windows Reboot Script
rem =
rem = This script detects the version of Windows that it is being run on and executes
rem = the correct shutdown command to perform a restart of that computer
rem =====================================================================================================
rem --------------------------------------------------------------------------------------------------------------------
rem - General Start Script
rem ----------------------
rem Setlocal
echo Restart Script Starting
date /T
time /T
echo.
:: Get windows Version numbers
for /f "tokens=2 delims=[]" %%G in ('ver') do (set _version=%%G)
for /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') Do (set _major=%%G& set _minor=%%H& set _build=%%I)
echo Major version: %_major% Minor Version: %_minor%.%_build%
if "%_major%"=="5" goto sub5
if "%_major%"=="6" goto sub6
echo Unsupported Windows OS version Detected
echo.
goto exit
rem --------------------------------------------------------------------------------------------------------------------
rem --------------------------------------------------------------------------------------------------------------------
rem - Windows Major Version 5
rem -------------------------
:sub5
::Win XP or 2003
if "%_minor%"=="2" goto sub5_2
echo Windows XP [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10
goto exit
:sub5_2
echo Windows 2003 or XP 64 bit [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10
goto exit
rem --------------------------------------------------------------------------------------------------------------------
rem --------------------------------------------------------------------------------------------------------------------
rem - Windows Major Version 6
rem -------------------------
:sub6
if "%_minor%"=="1" goto sub6_1
if "%_minor%"=="2" goto sub6_2
if "%_minor%"=="3" goto sub6_3
echo Windows Vista or Windows 2008 [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10 /d P:0:0
goto exit
:sub6_1
echo Windows 7 or Windows 2008 R2 [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10 /d P:0:0
goto exit
:sub6_2
echo Windows 8 or Windows 2012 [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10 /d P:0:0
goto exit
:sub6_3
echo Windows 8.1 [%PROCESSOR_ARCHITECTURE%]
echo.
echo Restarting Computer in 10 seconds
shutdown /r /f /c "Strobe IT Scheduled Reboot" /t 10 /d P:0:0
goto exit
rem --------------------------------------------------------------------------------------------------------------------
rem --------------------------------------------------------------------------------------------------------------------
rem - Windows Major Version 7
rem -------------------------
rem N/A
rem --------------------------------------------------------------------------------------------------------------------
rem --------------------------------------------------------------------------------------------------------------------
rem - General Finish Script
rem -----------------------
:exit
echo Restart Script Finished
date /T
time /T
rem exit
rem --------------------------------------------------------------------------------------------------------------------
Thanks
Robin