Shalm Posted June 20, 2008 Author Posted June 20, 2008 (edited) Success!! Func _GetActiveSSID() Local $line, $foo = Run(@ComSpec&" /c "&'netsh wlan show int', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While @OSVersion = "WIN_VISTA" $line = StringStripWS(StdoutRead($foo, "peek=True"), 4) If @error Then ExitLoop If StringInStr($line, "SSID") Then $line = StringTrimLeft($line, StringInStr($line, "SSID")+6) Return (StringTrimRight($line, StringLen($line)-StringInStr($line, "BSSID")+2)) ElseIf StringInStr($line, "disconnected") Then Return("None") EndIf Wend ;<== While @OSVersion = "WIN_VISTA" EndFunc ;<== _GetActiveSSID This works for me!! I am gonna try an XP version of this then add it when I am sure it works. Thanks for all the help guys! Edited June 20, 2008 by Shalm
sainumpudi Posted September 4, 2008 Posted September 4, 2008 Hi ResNullius, I have tried your code on xp worked fine on one box and didn't work on another XP box. Need to start WMI service before we use this code?. I have tried that too some it is not working on few XP boxes. Also wether WLAN is working on those boxes, but i didn't find WLAN also. If any one have any idea, Pls share with me. Func _GetActiveSSIDXP() Local $SSID = "" $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\wmi") $objMSNdis_80211_ServiceSetIdentifierSet = $objWMIService.ExecQuery("Select * from MSNdis_80211_ServiceSetIdentifier Where active=true") For $objMSNdis_80211_ServiceSetIdentifier In $objMSNdis_80211_ServiceSetIdentifierSet $ID = "" For $i = 0 To $objMSNdis_80211_ServiceSetIdentifier.Ndis80211SsId(0) $ID = $ID & Chr($objMSNdis_80211_ServiceSetIdentifier.Ndis80211SsId($i + 4)) Next $SSID = $ID Next Return $SSID EndFunc ;==>_GetActiveSSIDXP
sainumpudi Posted September 4, 2008 Posted September 4, 2008 Hi ResNullius, I have tried your code on xp worked fine on one box and didn't work on another XP box. Need to start WMI service before we use this code?. I have tried that too some it is not working on few XP boxes. Also wether WLAN is working on those boxes, but i didn't find WLAN also. If any one have any idea, Pls share with me. Func _GetActiveSSIDXP() Local $SSID = "" $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\wmi") $objMSNdis_80211_ServiceSetIdentifierSet = $objWMIService.ExecQuery("Select * from MSNdis_80211_ServiceSetIdentifier Where active=true") For $objMSNdis_80211_ServiceSetIdentifier In $objMSNdis_80211_ServiceSetIdentifierSet $ID = "" For $i = 0 To $objMSNdis_80211_ServiceSetIdentifier.Ndis80211SsId(0) $ID = $ID & Chr($objMSNdis_80211_ServiceSetIdentifier.Ndis80211SsId($i + 4)) Next $SSID = $ID Next Return $SSID EndFunc ;==>_GetActiveSSIDXP
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