Tlem Posted June 18, 2007 Posted June 18, 2007 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
PsaltyDS Posted June 18, 2007 Posted June 18, 2007 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 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
Tlem Posted June 21, 2007 Author Posted June 21, 2007 (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 runtimeYes, 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 I just need to know if the Network Cards are actives. Edited June 21, 2007 by Tlem Best Regards.Thierry
FreeFry Posted June 21, 2007 Posted June 21, 2007 (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? An example would be to ping your gateway, and if it fails, probably your Network card is not active. Edited June 21, 2007 by FreeFry
Tlem Posted June 23, 2007 Author Posted June 23, 2007 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now