It is currently April 24th, 2024, 4:16 pm

Help Getting Adapter Type Plugin to Show None

Get help with creating, editing & fixing problems with skins
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi SilverAzide

Thank you for technical clarification.
If you REALLY want to get serious, then don't use Rainmeter... there are more precise ways to determine if specific adapters are active.
Ah...right, but I am interested in getting adapter information in/by Rainmeter. :-) For me, it is "out-of-curiosity", not practical need.

Now I am working with powershell command you provided using RunCommand and WebParser. But there is a weird unsolved problem concerning with command prompt output (not your powershell command), so far.
I am enjoying. :-)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi thejlowe and SilverAzide

I am still not sure exactly what is LAN-connection and Internet-connection in the Sysinfo plugin...but anyway, I have made some little skin which shows network adapter connection status excluding Bluetooth adapter, based on SilverAzide's Powershell command.
Untitled-1.jpg
Lowest line is the value obtained by the ADAPTER_TYPE option of Sysinfo plugin. Because of the presence of Bluetooth adapter, it is still "Ethernet" despite both Ethernet and Wifi adapters are actually inactive. I don't know the reason.
And... "LAN adapter" is somewhat odd expression for me, but it is just an output from "WmiObject" (?! I don't know what at all).

Probably such skin is a "done deal" in this forum, but I enjoyed through making of this skin. :-)
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Help Getting Adapter Type Plugin to Show None

Post by SilverAzide »

mak_kawa wrote: November 11th, 2019, 7:11 am Probably such skin is a "done deal" in this forum, but I enjoyed through making of this skin. :-)
Here is another fun variation to try:

Code: Select all

Get-WmiObject -Class MSFT_NetAdapter -Namespace root\StandardCimv2 | Sort-Object -Property InterfaceType, Virtual, InterfaceDescription | Format-Table -Property @{Label='Interface Name'; Expression={$_.InterfaceDescription}}, @{Label='Connection'; Expression={$_.Name}}, Virtual, State, @{Label='Connected'; Expression={$_.MediaConnectState}}, @{Label='Type'; Expression={$_.InterfaceType}} -AutoSize
This adds the "Connected" column; 1=Connected, 2=Disconnected, 0=unknown. The "State" column shows if the adapter is enabled/disabled, but "Connected" will tell you if it is actively connected to anything (an adapter can be enabled but not connected). This column should correspond to Rainmeter's SysInfo LAN_CONNECTIVITY option in that if any adapter returns a "Connected" value of "1", then LAN_CONNECTIVITY should also return 1. The difference is the PS command will tell you WHICH adapters are connected instead of if ANY adapters are connected.
Gadgets Wiki GitHub More Gadgets...
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi SilverAzide

It's really fun... I was wondering "Can we get connection (not active/inactive) status shown in Window's adapter setting dialog??" for a long time. Your PS commmand just solved this question. Thanks a lot. -:)

Right away, I have adopted it. See the attached image. Superscript "1" after adapter class (LAN) shows the adapter is actually connected to network. And the attached image also indicates LAN and Wi-Fi adapters are both active, but only LAN adapter is connected to the network.
Untitled-1.jpg
As far as my Windows10, when I set two adapters connected to the network, Windows10 automatically disconnects one adapter (Wi-Fi) with some priority after a short time.
You do not have the required permissions to view the files attached to this post.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Maybe, I am making a lot of fuss for nothing...:-) But anyway;

It seems to me that the information from Sysinfo plugin and the Powershell command by SilverAzide can't detect physical (? what'd I say...) lost of network connection. As I have said in former post, when I detach router connector from optical cable terminal, the network adapter information still indicates as "connected" to network.

So, I have added ping reachability using Ping plugin. Internet ping destination is...secret, some "open & perpetual" internet site not rainmeter.net. :-) LAN ping destination is my LAN router.
Untitled.png
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Help Getting Adapter Type Plugin to Show None

Post by SilverAzide »

It sounds like you are unplugging your incoming internet cable from your router? If so, your PC is still connected to the router and will see an active local area network, so the PS script and the SysInfo LAN_CONNECTIVITY option will report the adapter as connected. But INTERNET_CONNECTIVITY will return -1. Here is a way to check:

Code: Select all

[MeasureIsLANConnected]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY

[MeasureIsWANConnected]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY

[MeasureNetwork]
Measure=Calc
; returns -2 (no network), 0 (LAN but no WAN), +2 (LAN and WAN)
Formula=MeasureIsLANConnected + MeasureIsWANConnected
DynamicVariables=1
So if MeasureNetwork returns -2, then you've lost all connectivity, 0 means you are connected to your LAN only, and +2 mean you are connected to the internet. (It is not possible to have a WAN connection without a LAN connection, so you don't have to check for that case.) The PS script will report your "media connected state" (the "Connected" column) as 2 (disconnected) only when the adapter has lost all network connectivity (like if you turn off your router or disconnect the network cable to your PC). With the PS script, there will be a brief delay as your adapters re-negotiate and re-try connections, but within a few seconds it will show the proper state of your network connectivity.
Gadgets Wiki GitHub More Gadgets...
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi SilverAzide

Thank you for spending time with this subject.
It sounds like you are unplugging your incoming internet cable from your router?
Yes, exactly.
INTERNET_CONNECTIVITY will return -1.
Ah... no, at least for my PC, when I detached the cable, INTERNET_CONNECTIVITY value stays 1 (connected) permanently, despite lost of actual internet connectibity/reachability.
Then, I think Windows does not check actual internet connectivity, and doesn't care what is happen over the router->terminal->WAN. If so, what is INTERNET_CONNECTIVITY value from Sysinfo plugin?? Possibly I am wrong. :-)

I am missing something, or something may be wrong in my PC/adapter/driver and network environments, but I can't figure out so far. So, I have decided to judge actual internet connectivity by ping result.