Jump to content

Enable/Disable network card WMI


colombeen
 Share

Recommended Posts

Hi guys

I've been looking around to enable/disable network cards using WMI but so far the only way i could get it to work was with this :

RunWait(@ComSpec & " /c " & "WMIC PATH Win32_NetworkAdapter WHERE Index=" & $NetAdp_CurrID & " CALL " & $action, "", @SW_HIDE)

The $NetAdp_CurrID var would be the index of the network card and the $action var would be enable or disable in my line of code.

I know it's possible to do this with wmi without using cmd but i can't figure out how.

Anyone who has the answer to my problem?

I've tried with using the wmi query and adding .enable() and .disable() at the end but that doesn't work (or at least not for me)

Edited by colombeen
more info
Link to comment
Share on other sites

  • 1 month later...

You can call WMI methods directly with AutoIt.

Look at my network UDF (https://www.autoitscript.com/forum/topic/155539-network-configuration-udf/) : _EnableNetAdapter / _DisableNetAdapter


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...