Solved

Network cards

Posted on 2004-08-09
9
716 Views
Last Modified: 2013-11-15
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
Comment
Question by:ice_nin
  • 4
9 Comments
 
LVL 22

Expert Comment

by:grg99
ID: 11757330
If you have "netsh" on the computers, you can issue "netsh interface show interface" and "netsh interface delete interface xxxx"  commands.

0
 
LVL 22

Expert Comment

by:grg99
ID: 11757453
You could also do "ipconfig /release xxxx".

0
 

Author Comment

by:ice_nin
ID: 11758226
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 22

Expert Comment

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

"netsh interface show interface"
0
 
LVL 14

Accepted Solution

by:
wayside earned 125 total points
ID: 11774060
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
 
LVL 22

Assisted Solution

by:grg99
grg99 earned 125 total points
ID: 11774599
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How to fix error ""Failed to validate the vCentre certificate. Either install or verify the certificate by using the vSphere Data Protection Configuration utility" when you are trying to connect to VDP instance from Vcenter.
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now