Re: Router Configuration
From: Roland Hall (nobody_at_nowhere)
Date: 10/23/04
- Next message: McKirahan: "Re: script to list objects in descending order by size and show path"
- Previous message: Rob Fisk: "VBScript regular expression problem"
- In reply to: Brian Staff: "RE: Router Configuration"
- Next in thread: Brian Staff: "Re: Router Configuration"
- Reply: Brian Staff: "Re: Router Configuration"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 22 Oct 2004 21:31:08 -0500
"Brian Staff" <brianstaff@[NoSpam]compuserve.com> wrote in message
news:VA.0000029b.0e8b26c6@bstaffw2k.jda.corp.local...
:> netsh machine name=daugtersmachine offline
: >
: > this turns your dougters NIC off, and she won't be able to turn it on
from
: > windows.
:
: Thank-you so much...I think this will do exactly what I want. After
looking over the
: commands in MSDN, I have a question about your syntax: is "machine" the
actual word
: "machine" or is it the name of the router? I could not find the syntax you
suggested in the
: docs.
:
: Brian
:
: for those lurking, I found these:
:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netshell/netshell/netshell
: _root_context.asp
Actually that is incorrect for 2 reasons:
1. W2K and XP do not support diabling the NIC with netsh. You can however
change the address.
2. Depending on rights, she may or may not have access to set it back but
she would also need to know what to look for. Note: And if she doesn't have
rights to set it back, she cannot set it in the first place. Scripting
using impersonation might be an option here.
This will work on XP, I've tested it and it assumes you are currently using
DHCP to assign the correct network settings otherwise you will need to
change line 2 similar to line 1 with the correct settings.
To effectively disable her networking:
1. netsh interface ip set address="Interface Name" static 1.1.1.1 255.0.0.0
none
This sets:
IP Address: 1.1.1.1
Subnet Mask: 255.0.0.0
no gateway
To reenable it using DHCP
2. netsh interface ip set address="Interface Name" dhcp
If her network settings were static and not dynamic and assuming they were
192.168.0.2 255.255.255.0 DFG 192.168.0.1 change line 2 to:
netsh interface ip set address="Interface Name" static 192.168.0.2
255.255.255.0 192.168.0.1 1
"Interface Name" is double quotes around the name of the interface. By
default I think it is Local Area Connection but you can rename it. I named
mine LAN1. In my case "LAN1" would be used instead of "Interface Name".
So, what do you need to automate this and not have to worry about it?
I created 2 files: offline.cmd and online.cmd
-offline.cmd-
@echo off
netsh interface ip set address name="LAN1" static 1.1.1.1 255.0.0.0 none
-online.cmd-
@echo off
netsh interface ip set address name="LAN1" dhcp
I have mine in the root but I suggest you put yours somewhere else and don't
forget to either rename her interface or modify LAN1 to the interface name
she has.
I then entered these two commands in at the command prompt:
at 23:00 /every:M,T,W,Th,F,S,Su "c:\offline.cmd"
at 8:00 /every:M,T,W,Th,F,S,Su "c:\online.cmd"
Type: at by itself to see that they are scheduled.
To remove them one day, use: at /delete
The downside, if she finds it, she can change it, depending on rights. It's
something you have to look for and even though she may not know, she may
know someone who does. What I'm not sure of is if her computer is not on at
11pm, and she turns it on later, will it run the scheduled event. If not,
you'll have to work harder so that when the system is logged on it checks to
see if it is between 11pm and 8am and if so, run offline.cmd. This will
most likely require scripting.
If you need to script this, post back.
HTH...
-- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp
- Next message: McKirahan: "Re: script to list objects in descending order by size and show path"
- Previous message: Rob Fisk: "VBScript regular expression problem"
- In reply to: Brian Staff: "RE: Router Configuration"
- Next in thread: Brian Staff: "Re: Router Configuration"
- Reply: Brian Staff: "Re: Router Configuration"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|