Skip to content

Instantly share code, notes, and snippets.

@NiKiZe
Created May 1, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiKiZe/00dc3386148bf86fcb8d to your computer and use it in GitHub Desktop.
Save NiKiZe/00dc3386148bf86fcb8d to your computer and use it in GitHub Desktop.
@TITLE Start install
@call :getips
@echo Hostname:%HOSTNAME%
@echo IP: %IP%
@echo Mask: %MASK%
@echo Gateway: %GATEWAY%
@echo MAC: %MAC%
@echo.
@echo. > %systemroot%\hwids.post
@echo ^&ip=%IP% >> %systemroot%\hwids.post
@echo ^&gw=%GATEWAY% >> %systemroot%\hwids.post
@echo ^&mac=%MAC% >> %systemroot%\hwids.post
@echo ^&hostname=%HOSTNAME% >> %systemroot%\hwids.post
@echo ^&ipconfig= >> %systemroot%\hwids.post
@ipconfig /all >> %systemroot%\hwids.post
@type %systemroot%\hwids.post
%systemroot%\wget -t 1 -T 10 --post-file %systemroot%\hwids.post http://server/pxe/bootstrap_winpe.php?ARCH=%PROCESSOR_ARCHITECTURE% -O %systemroot%\dlscript.cmd
IF %ERRORLEVEL% == 0 (
call %systemroot%\dlscript.cmd
) ELSE (
@echo downloaderror
if EXIST nodownload.cmd call nodownload.cmd
)
@IF EXIST %systemroot%\dlscript.cmd del %systemroot%\dlscript.cmd > NUL
@goto :EOF
:getips
@for /f "delims=: tokens=1-2" %%c in ('ipconfig /all ^| find /i "nam"') do @set HOSTNAME=%%d
@SET HOSTNAME=%HOSTNAME: =%
@for /f "delims=: tokens=1-2" %%c in ('ipconfig ^| find /i "IP" ^| find /i "dress"') do @set IP=%%d
@SET IP=%IP: =%
@for /f "delims=: tokens=1-2" %%c in ('ipconfig ^| find /i "mask"') do @set MASK=%%d
@SET MASK=%MASK: =%
@for /f "delims=: tokens=1-2" %%c in ('ipconfig ^| find /i "gateway"') do @set GATEWAY=%%d
@SET GATEWAY=%GATEWAY: =%
@for /f "delims=: tokens=1-2" %%c in ('ipconfig /all ^| find "Physical Address"') do @set MAC=%%d
@for /f "delims=: tokens=1-2" %%c in ('ipconfig /all ^| find /i "Fysisk adress"') do @set MAC=%%d
@SET MAC=%MAC: =%
@goto :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment