• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 732
  • Last Modified:

Network cards

I have been asked by my company to write something that will detect if certain processes are running on a machine ( Job Done )  - the next task was to remove the computer from the network if certain processes weren’t running. Here is my dilemma - I posed a question the other day asking how to force a computer to go into Hibernate ( after a little work I got it working See : http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21084465.html). But I didn’t like killing a computer incase it was mission critical.

I managed to convince the network people that:
A - Not all the computers on the network will support Hibernate ( window 98, NT 4 etc.)
B - Developers will get P*ssed if I shutdown the machine (even if I hibernate the state of the machine) - because I know I would be P*ssed
C - Build / Integration people may be doing a build of a product i.e. cost the company a lot of money if I kill that half way

I need a method to enumerate all network cards on the machine and disable them, keeping the machine on and working (locally at lest) but it’s better than killing the machine until I.T. get a chance to look at it.

Thanks in advance for you input.

P.S. We do have Linux and Unix Machines on the network but these will not be affected by this tool, so feel free to make suggestions windows specific, but please keep in mind that everything as far back as win98 will have be considered
0
ice_nin
Asked:
ice_nin
  • 4
2 Solutions
 
grg99Commented:
If you have "netsh" on the computers, you can issue "netsh interface show interface" and "netsh interface delete interface xxxx"  commands.

0
 
grg99Commented:
You could also do "ipconfig /release xxxx".

0
 
ice_ninAuthor Commented:
Firstly i would have to have a list of the interfaces i wanted to release in either of the suggested methods (?). How easy is it to obtain a list of all network devices on the machine in code?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
grg99Commented:
>How easy is it to obtain a list of all network devices on the machine in code?

"netsh interface show interface"
0
 
waysideCommented:
If you want to do this programatically you can do it using the INet* COM interfaces such as INetCfg, IEnumNetCfgComponent, INetCfgBindingPath, IEnumNetCfgBindingPath, INetCfgComponent, INetCfgBindingInterface, and IEnumNetCfgBindingInterface.

There's a program with source in the DDK called "Bindview", which uses these interfaces to walk all of the network services and enumerate all of the bindings for each service. You can then check their status and enable/disable them. You can see how to use the COM interfaces by examining the source code, I found the docs on these to not be very good.

Taking a sledgehammer approach such as deleting all the interfaces may not be ideal, as you will eventually want to restore this system to the network. Doing an "ipconfig /release" is trivially undoable once a user realizes he's been disconnected, it doesn't seem like a rigorous solution.
0
 
grg99Commented:
There's no easy and thogough solution for this..  My lame "ipconfig /release" is only going to shut down TCP binding, not any other installed protocols.  Now you could argue that the other protocols like NetBuei and NetBIOS shouldnt be running anymore, so they're not a big problem.

I'd probably just have the program send a message to some flunky whose job is to go to that computer and pull the network cable.

  Or if you have semi-intelligent network hubs, write a program to disable the network cable from the hub end.  Yep, that's the ticket!



0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now