The various Windows API for searching the network such as WNetEnumResource
is dog slow and unreliable.
With IPv4 the suggestion is you can loop through the subnet and send an ARP
or PING
request to find live systems (without firewall blocking) and from there query them for Windows specific resources. Kind of a crummy way to have to do it but with most IPv4 subnets being relatively small, feasible. However, with IPv6 with so many devices available, trying to ARP
or PING
a range seems unreasonable.
I guess you also have WINS
or Active Directory
which may have computers in them, but in AD they may no longer exist and only contain systems that have joined a domain.
While I know this general question has been asked, I've not found that a good answer has ever been given. Has this been addressed and is there a reliable fast way today, in 2021, to get a list of all active systems on the network using C/C++ especially with IPv6 growing? If so, what is it and is there sample code?
TIA!!
Here's the sample requested with names changed:
NETRESOURCE[0] Scope: all resources
NETRESOURCE[0] Type: any
NETRESOURCE[0] DisplayType: network
NETRESOURCE[0] Usage: 0x80000002 = container
NETRESOURCE[0] Localname: (null)
NETRESOURCE[0] Remotename: Microsoft Terminal Services
NETRESOURCE[0] Comment: (null)
NETRESOURCE[0] Provider: Microsoft Terminal Services
NETRESOURCE[1] Scope: all resources
NETRESOURCE[1] Type: any
NETRESOURCE[1] DisplayType: network
NETRESOURCE[1] Usage: 0x80000002 = container
NETRESOURCE[1] Localname: (null)
NETRESOURCE[1] Remotename: Microsoft Windows Network
NETRESOURCE[1] Comment: (null)
NETRESOURCE[1] Provider: Microsoft Windows Network
NETRESOURCE[0] Scope: all resources
NETRESOURCE[0] Type: any
NETRESOURCE[0] DisplayType: domain
NETRESOURCE[0] Usage: 0x2 = container
NETRESOURCE[0] Localname: (null)
NETRESOURCE[0] Remotename: DOMAINXX
NETRESOURCE[0] Comment: (null)
NETRESOURCE[0] Provider: Microsoft Windows Network
NETRESOURCE[0] Scope: all resources
NETRESOURCE[0] Type: any
NETRESOURCE[0] DisplayType: server
NETRESOURCE[0] Usage: 0x2 = container
NETRESOURCE[0] Localname: (null)
NETRESOURCE[0] Remotename: \\XXX03
NETRESOURCE[0] Comment:
NETRESOURCE[0] Provider: Microsoft Windows Network
NETRESOURCE[0] Scope: all resources
NETRESOURCE[0] Type: disk
NETRESOURCE[0] DisplayType: share
NETRESOURCE[0] Usage: 0x1 = connectable
NETRESOURCE[0] Localname: (null)
NETRESOURCE[0] Remotename: \\XXX03\vmshare
NETRESOURCE[0] Comment: VM Share for VirtualBox running VirtualPC machines.
NETRESOURCE[0] Provider: Microsoft Windows Network
NETRESOURCE[2] Scope: all resources
NETRESOURCE[2] Type: any
NETRESOURCE[2] DisplayType: network
NETRESOURCE[2] Usage: 0x80000002 = container
NETRESOURCE[2] Localname: (null)
NETRESOURCE[2] Remotename: Web Client Network
NETRESOURCE[2] Comment: (null)
NETRESOURCE[2] Provider: Web Client Network
WnetOpenEnum failed with error 1222
EnumerateFunc returned FALSE
Pic of browse and one of actually entering the \server on the quick access bar
Note there are a couple of other servers too.
User contributions licensed under CC BY-SA 3.0