2 VB Scripts one to remove Default Gateway and one to add a Default Gateway

vbscriptwindows 7windows-server-2008-r2

I have a client with a bunch of children using about 30 machines on a regular basis.

All machines that the children user are set with Static IP Addresses.

The machines that the kids use, I would like to be able to run a script that will remove the default gateway so they cant get to the Internet.

Then I need another that will add the Default gateway, so Windows and software updates can be run.

Both scripts need to use the domain admin account for permissions

Any help would be greatly appreciated

Best Answer

Is there any reason you are using static addressing? This complicates your network and is generally unnecessary - you could use DHCP and create reservations to accomplish the same thing and have better control.

I would also be using WSUS (free) to deploy updates - with the server on the same subnet, the workstations need never connect to the internet.

Otherwise, I wouldn't do this with vbscript - netsh should be able to handle this easily for you, running with PSEXEC and assuming these sysetms are all on the same domain.

psexec @File-WithComputerNames.txt netsh interface ip set address "Local Area Connection" gateway=192.168.111.222 gw=1 (Make sure all the network adapters have the same name, otherwise you need a text file indicating computer/adapter name and use a for loop. Or you could probably do something fancier with WMIC to obtain the adapter name. (sorry, not good enough with WMIC to give a sample of that).

Related Topic