Windows 7 Using netsh command to remotely change ip address and then reboot the machine

  • Thread starter Thread starter DannyHo1
  • Start date Start date
D

DannyHo1

I have successfully wrote a script ".bat" file to reboot the machine, and I have started a script to change the IP of the remote machine, but it doesn't seem to work. Here is my proposed script:


@echo off
cls
color 2E
echo.
set /p UserPC= ENTER a computer name to Reboot:

set /p IPADDR= Enter IP address to change to:

set newpc= /r /f /m "\\%UserPC%" /t 000
echo.
echo Press a key to EXECUTE Reboot and IP Change!!!
pause > nul
shutdown %newpc%

netsh -r %UserPC% -u ournetwork.com\ourtechuseracct int ip set address "Local Area Connection" static %IPADDR% 255.255.255.0 192.168.101.1 1

echo.
echo EXECUTE initiated
echo.
echo Press Any key to EXIT...
echo.
pause > nul
exit



With the exception of "ournetwork.com/outtecfhuseracct" and the IP gateway address being bogus, what am I missing in the above script?


Danny Ho, PC Medic

Continue reading...
 
Back
Top