Sign in to follow this  
Followers 0
Tlem

Is NetCard Active ?

5 posts in this topic

Hello.

I would like to know if there is a way to know if Net card is active or not.

It must be compatible between Win XP and Win98 and also support different language.

I try a lot of thing, but there is no compatibility between Win98 and WinXP.

- I try with registry, but it's not the same keys between the OS.

- I try a VBScript that I find on Internet (How toggle the net card), but you must specifies the network folder name, and if you launch the script on PC with different language, it's not working (If there is a way to take the network folder name with script it will be ok).

- I try a WMI script, but Windows 98 doesn't like it.

- I try Netsh, but doesn't work for 1394 lan card and not compatible with Win98.

So if someone know an other way to know if a net card is active (a dos utilities that's return the state of a network card, or DLL use, or registry use), I will appreciate help.

PS:

I have this code to have informations about net card, and use devcon.exe to activate or deactivate a net card.

$RegNic1 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\"
    $RegNic3 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"

    For $i = 1 To 10
        $nicid[$i] = RegEnumKey($RegNic1, $i)
        $nicdesc[$i] = RegRead($RegNic1 & $nicid[$i], "Description")
        $nicid[$i] = RegRead($RegNic1 & $nicid[$i], "ServiceName")
        $PnpId[$i] = RegRead($RegNic3 & $nicid[$i] & "\Connection", "PnpInstanceID")
        $NetName[$i] = RegRead($RegNic3 & $nicid[$i] & "\Connection", "Name")
        $nicid[0] = $i - 1
        If @error <> 0 Then ExitLoop
    Next

Best Regards.Thierry

Share this post


Link to post
Share on other sites



I would like to know if there is a way to know if Net card is active or not.

It must be compatible between Win XP and Win98 and also support different language.

If you've found a technique that works for you in Win98, and another that works in XP, just use the macro @OSVersion to choose the method at runtime:

MsgBox(64, "AutoIt OS Macros", "@OSVersion =  " & @OSVersion & @CRLF & _
        "@OSType = " & @OSTYPE & @CRLF & _
        "@OSBuild = " & @OSBuild & @CRLF & _
        "@OSServicePack = " & @OSServicePack & @CRLF & _
        "@OSLang = " & @OSLang)

Switch @OSVersion
    Case "Win_Vista"
        MsgBox(64, "Win_Vista", "Do Vista stuff...")
    Case "Win_XP"
        MsgBox(64, "Win_XP", "Do XP stuff...")
    Case "Win_98"
        MsgBox(64, "Win_98", "Do 98 stuff...")
    Case Else
        MsgBox(16, "Error", "Unhandled case: @OSVersion = " & @OSVersion)
EndSwitch

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you've found a technique that works for you in Win98, and another that works in XP, just use the macro @OSVersion to choose the method at runtime

Yes, I know this Way, and I will be probably obliged to make that.

But if there is another Way, the code will be more simple :rolleyes:

I just need to know if the Network Cards are actives.

Edited by Tlem

Best Regards.Thierry

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

How about using the Ping() function?

Is there some target that's always supposed to be there, if so you could probably try and ping it? :rolleyes:

An example would be to ping your gateway, and if it fails, probably your Network card is not active. :rambo:

Edited by FreeFry

Share this post


Link to post
Share on other sites

Yes I can do it.

But I would like to know if the Net Card is active even if she's not connected.

I make an UDF that list all net cards present on computer, and if the net cards are active or not (even if they are connected or not).


Best Regards.Thierry

Share this post


Link to post
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
Sign in to follow this  
Followers 0