Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hardware Enable/Disable? 1

Status
Not open for further replies.

Smithsco

Technical User
Mar 30, 2003
89
0
0
AU
Is it possible to enable and or disable hardware shuch as a NIC using VBS?
 
Smithsco,

No 100% sure what you really mean by enabling and disabling hardware... But WMI might be able to do some of what your looking for. I know there is a script to release a DHCP lease for a NIC and to renew a lease. But doing so remotely could be pretty dangerous.. Take a look at the following.

Scriptomatic (WMI Wizard) from Microsoft...



HTH



DougCranston
 
I have a machine with two NICS, however I can only be n one network at a time, so I would like to disable Nic(1) and enable Nic(2) copy some files and then swap them back over.

I know I can also do this by changing IP address' however I would prefer to disable the NIC.
 
Yes you can use WMI to disable a nic as well as set all of the properties for the adapter itself. Check out the Win32_NetworkAdapterConfiguration class. It should have methods available to it to do what you are after.

HTH

Z
 
Why can you only be on one network at a time? Is this a written policy you have to work under? What operating system are we talking about here?
 
ive got a script to do something similar.
so far i have only implemented it to display a message warning the user they should disconnect one of their devices. if people agree then i will implement a disablin of one of the network devices. i plan to use on of the WMI Win32_NetworkAdapterConfiguration properties that have already been suggested. All i need to do i find out which was are read only!!!

the reason we want to disable a NIC is for people who have a wireless lan connection at the same time as having a NIC LAN connection to our network, we see it as some what of a security issue, actiing like some sort of bridge. i know the answer to all this is a personal firewall but we havent choosen one yet...anyhow

von moyla
 
mrmovie,

When working with WMI, to find out what what methods of a class are read only I use a little known but very powerful tool that is already in Win 2000/XP. Here is how to pull it up.

Start---->Run----> type "wbemtest"

It will pull up a small interface click on Connect. It will ask what namespace you want to connect to, put in root\cimv2, click Login. It will bring you back to the main pop-up but all the buttons are available now. Click on Enum Classes, it will bring up a pop up, select the recursive radio button and click OK. It will then bring up the top level classes in the namespace that you choose. Now scroll down and select the Win32_NetworkAdapterConfiguration and doubleclick. It will pull up a very interesting dialog box. In this box at the bottom, it will list all of the methods available in that class, double click on one and it will tell you more indepth info about that particular method. Usually based on this info I can tell whether it is read only or not as well as many other useful items with WMI scripting. The only thing that I don't like is that you cant maximize it to avoid all the scroll bars, but Oh well.

HTH

Z
 
thanks for the useful hint.

regards
richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top