Retrieve port to which a device is connected via powershell - windows

I use the following command to gain information about certain connected devices
Get-PnpDevice -Class <class> -Status <status>
Is there a way to retrieve the port to which a device is connected? I also want to retrieve the ports exact name (like USB Root Hub Port X for example).
Thanks in advance.

Related

Does netstat command show devices, printers on your wifi network?

What network utility on a MAC can help me see what devices, printers are available, listening etc on my wifi. Netstat does not seem to show me my printer or Android device. For example,
My macbook pro with ip address 10.1.140.255 but I can't see my Android phone with ip 10.1.140.77 or a printer on 10.1.140.95.
Considering that some of your devices may be passively just sitting there with no active connections to your computer, you can't find them by examining your computer; you'll have to go actively looking for them. That typically means a network scanner.
Here's a list: https://www.softwaretestinghelp.com/network-scanning-tools/
I like Nmap (https://nmap.org) with the Zenmap GUI (https://nmap.org/zenmap)
Just make sure you do this in your own network. Scanning somebody else's network will trigger alarms and is more than likely illegal.
Try arp -a instead. Netstat doesn't scan the network, it just provides information about your own device's connection to the network.
Edit: Try ifconfig | grep broadcast | arp -a
When you're on LAN, connecting to an IP involves resolving the IP into a mac address. ARP keeps a cache of all resolved IP addresses. Doing a broadcast ping indirectly triggers a resolution for all IPs on the network.
https://superuser.com/questions/124453/how-can-i-scan-the-local-network-for-connected-devices-mac-os

My MAC is connected to both Ethernet and Wifi at time,how can i detect from which network is getting acessed

My MAC is connected to Ethernet and Wifi at a time. Both are different networks. I wanted to know from which interface my system is accessing internet. I want a command to check this. By giving
traceroute google.com , i can get default route, as i know ip addresses of both networks. But the case is how can i detect this in remote machines whose ip addresses are unknown
when i give
ifconfig
I see en0 and en1 are assigned with two diff ips and are active. Even from this i am unable to differentiate.
I achieved this by following below procedure
1) networksetup -listnetworkserviceorder , by using this we will network service order of MAC, along with interface to which it is connected
2) route get default | grep interface gives the currently using interface.
By checking current interface with service order, we can know from which interface our mac is accessing internet

Finding IP address for Zebra LP2844-Z USB

Trying to find the IP address of my Zebra LP2844-Z USB connected printer.
Need to print from my android APP using labelworks SDK.
I need the IP and Port for my printer.
What is the best way to get this?
Thanks
If your model comes with ethernet connection:
On the back of the printer, next to the ethernet connection there should be a small button. Press this and the printer gives you a label shoving existing network configuration.
When you have the ip you can access settings in web gui using this IP as address.
Else if your model is using USB only:
You would have to set up the printer on a PC (or other usb printer hosting capable device) and share the printer on the network. Then the printer ip, or address on the network is \\computername/ip\printername/port
You can use the Zebra Setup Utility (https://www.zebra.com/us/en/support-downloads/desktop/lp-2844-z.html). Use the Open Communications With Printer option to send the command:
! U1 getvar "ip.addr"
Make sure you end the command with an Enter (CRLF) or the printer will not respond.
The IP address should be displayed in the results window, below the command window.
As Russel suggests, ust the Zebra Setup Utility to "Open Communications with Printer". Type:
~WC
The printer will print a network configuration label with it's IP address and other network information. The default port is 9100.
The printer is too old a model to support the command Russel suggested although it works on most newer Zebra printers.

Find IP address of directly connected device

Is there a way to find out the IP address of a device that is directly connected to a specific ethernet interface? I.e. given one host, one wired ethernet connection and one second host connected to this wired connection, which layer or protocol below IP could be used to find this out.
I would also be comfortable with a Windows-only solution using some Windows-API function or callback.
(I know that the real way to do this would probably via DHCP, but this is about discovering a legacy device.)
Mmh ... there are many ways.
I answer another network discovery question, and I write a little getting started.
Some tcpip stacks reply to icmp broadcasts.
So you can try a PING to your network broadcast address.
For example, you have ip 192.168.1.1 and subnet 255.255.255.0
ping 192.168.1.255
stop the ping after 5 seconds
watch the devices replies : arp -a
Note : on step 3. you get the lists of the MAC-to-IP cached entries, so there are also the hosts in your subnet you exchange data to in the last minutes, even if they don't reply to icmp_get.
Note (2) : now I am on linux. I am not sure, but it can be windows doesn't reply to icm_get via broadcast.
Is it the only one device attached to your pc ?
Is it a router or another simple pc ?
To use DHCP, you'd have to run a DHCP server on the primary and a client on the secondary; the primary could then query the server to find out what address it handed out. Probably overkill.
I can't help you with Windows directly. On Unix, the "arp" command will tell you what IP addresses are known to be attached to the local ethernet segment. Windows will have this same information (since it's a core part of the IP/Ethernet interface) but I don't know how you get at it.
Of course, the networking stack will only know about the other host if it has previously seen traffic from it. You may have to first send a broadcast packet on the interface to elicit some sort of response and thus populate the local ARP table.
Windows 7 has the arp command within it.
arp -a should show you the static and dynamic type interfaces connected to your system.
Your Best Approach is to install Wireshark, reboot the device wait for the TCP/UDP stream , broadcasts will announce the IP address for both Ethernet ports
This is especially useful when the device connected does not have DHCP Client enabled, then you can go from there.
You can also get information from directly connected networking devices, such as network switches with LDWin, a portable and free Windows program published on github:
http://www.sysadmit.com/2016/11/windows-como-saber-la-ip-del-switch-al-que-estoy-conectado.html
LDWin supports the following methods of link discovery: CDP (Cisco Discovery Protocol) and LLDP (Link Layer Discovery Protocol).
You can obtain the model, management IP, VLAN identifier, Port identifier, firmware version, etc.

Embedded Linux - Get Signal Strength of Modem While Connected

I am running a USB cell modem via PPP in Embedded Linux. I can use AT commands via minicom to connect to the modem and interrogate the signal strength (AT+CSQ) when the PPP connection is not active. However, when it's active, this is not possible.
Is there any way to retrieve the signal strength from a PPP connected USB cell modem while the PPP connection is being used? I am open to an API or any other method available.
I don't have a umw190, but the Linux driver for the modem should have more than one ttyACM character device available. Use one for PPP and the other for AT+CSQ. Check dmesg for cdc_acm to see.
If your embedded device has udev then both devices should automagically appear in /dev. If not you'll have to mknod more. Off the top of my head major number is 166 for cdc_acm.
What does the physical setup look like?
1. Are you using a modem that is on a board designed/printed by the same company as your SBC?
2. Is it connected via something like PC104 serial or USB?
3. What specific modem are you using?

Resources