silent001 Posted February 3, 2016 Share Posted February 3, 2016 Hello All.I am looking for a script that can get the SSID of the wifi network the pc is connected to. I want to write a script that checks if the pc is connected to a specific network and if it is then do something. I found many scripts but they all return blank for SSIDon error resume nextPrivate Sub GetWMI(WMIArray, WMIQuery)On error resume Next Set WMIClass = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\wmi") If not(WMIClass is nothing) Then Set WMIArray = WMIClass.ExecQuery(WMIQuery)End SubFunction SSID()On error resume Next Call GetWMI(objMSNdis_80211_ServiceSetIdentifierSet, "Select * from MSNdis_80211_ServiceSetIdentifier Where active=true") For Each 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 NextEnd Functionwscript.echo SSID()I dont know why it blank please help me Link to comment Share on other sites More sharing options...
Tripredacus Posted February 3, 2016 Share Posted February 3, 2016 That method appears to be a common thing for XP, but for later OSes, people say to parse the output of netsh. netsh wlan show int Link to comment Share on other sites More sharing options...
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