Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for /f "usebackq tokens=2" %%f in (`netsh int ipv4 show ipaddress "Local area connection" ^| findstr /c:"Parameters"`) do SET ADDR=%%f
  2. for /f "tokens=3 delims=." %%a in ("%ADDR%") do set START_ADDR=%%a
  3. for /f "tokens=4 delims=." %%a in ("%ADDR%") do set END_ADDR=%%a
  4.  
  5. echo  %START_ADDR%.%END_ADDR%
  6.  
  7. set /a x=%START_ADDR%-1
  8. set /a xx=%START_ADDR%-1
  9. IF %END_ADDR% EQU 10 x=%START_ADDR%
  10.  
  11. if /i "%computername%" == "node0%x%%END_ADDR%" goto :cond
  12. if /i "%computername%" == "node%x%%END_ADDR%" goto :cond
  13.  
  14. for /f "usebackq tokens=8" %%f in (`netsh int ipv4 show interfaces ^| findstr /c:"4092"`) do SET ADDR=%%f
  15.  
  16. netsh interface ip set address name="Local area connection %ADDR%" static 10.12.%START_ADDR%.%END_ADDR% 255.255.0.0
  17.  
  18. IF %xx% LSS 10 (WMIC computersystem where caption="%computername%" rename "node0%x%%END_ADDR%") ELSE (WMIC computersystem where caption="%computername%" rename "node%x%%END_ADDR%")
  19.  
  20. shutdown -r -f -t 30
  21. exit
  22.  
  23. :cond
  24. echo "normal node"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement