Discussion:
Finding names of computers in network
(too old to reply)
Tom Del Rosso
2024-09-23 20:55:20 UTC
Permalink
This is easy in a domain, but the problem is peer-to-peer at home.

To get a list of computers in the network, this usually works:

NET VIEW /NETWORK

But sometimes computers don't show, even though they are running and can
be pinged.

After a DIR of a share on the other PC, then it usually appears in the
list.

So, that "wakes up" its server service or something. The computer is
already awake and not hibernating or sleeping.

But you need the computer name first before you can do the DIR, and
finding the name is the objective.

Know a reliable way to get computer names in a peer-to-peer network?
--
Defund the Thought Police
Tom Del Rosso
2024-09-23 23:31:48 UTC
Permalink
Post by Tom Del Rosso
Know a reliable way to get computer names in a peer-to-peer network?
Well, PSEXEC might work better. I've used it in domain networks before
but I'm surprised it works as well in a peer-to-peer network.
Good so far, but I'll see if it sometimes fails like NET VIEW /NETWORK
does.


D:\UTIL\Sysinternals>psexec \\* cmd /c set computername

PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

Enumerating domain...
\\FRED:

COMPUTERNAME=FRED
cmd exited on FRED with error code 0.
\\TRAPPER:

COMPUTERNAME=TRAPPER
cmd exited on TRAPPER with error code 0.
--
Defund the Thought Police
Tom Del Rosso
2024-09-24 03:54:58 UTC
Permalink
Post by Tom Del Rosso
Well, PSEXEC might work better.
...but it doesn't.

Still looking for a solution.
--
Defund the Thought Police
Ammammata
2024-09-24 06:48:19 UTC
Permalink
Post by Tom Del Rosso
Know a reliable way to get computer names in a peer-to-peer network?
I use this, but it has a GUI:

https://filehippo.com/download_softperfect-network-scanner/6.2.1/

note: it's an *old* version, the last free trial to use that shows all
the info

in newer versions part of details are hidden
--
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
-=- -=- -=- -=- -=- -=- -=- -=- - -=-
........... [ al lavoro ] ...........
JJ
2024-09-24 06:48:52 UTC
Permalink
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
NET VIEW /NETWORK
But sometimes computers don't show, even though they are running and can
be pinged.
After a DIR of a share on the other PC, then it usually appears in the
list.
So, that "wakes up" its server service or something. The computer is
already awake and not hibernating or sleeping.
But you need the computer name first before you can do the DIR, and
finding the name is the objective.
Know a reliable way to get computer names in a peer-to-peer network?
I think this is a problem in the network communication part, where the
response timeout is too low. The problem is common in Windows (all versions;
even if power management is not interfering), but rarely occur in Linux. So
if there is a setting for that timeout, it would be my prime suspect.
Tom Del Rosso
2024-09-27 08:10:27 UTC
Permalink
Post by JJ
I think this is a problem in the network communication part, where the
response timeout is too low. The problem is common in Windows (all
versions; even if power management is not interfering), but rarely
occur in Linux. So if there is a setting for that timeout, it would
be my prime suspect.
Thanks all for trying, but in the absence of a better command line
method, I used a work-around.

Since NET VIEW /NETWORK works for all machines sometimes, this saves
them for future reference so it doesn't need to find them every time.

Its purpose is to locate USB drives on whichever PC they might be
plugged in to, so a backup script can use the drive even if I moved it.
It does require that the remote PC has previously established a share on
the drive.

I called it FindVolSN.cmd and I can call it like this for example:

for /f "tokens=4" %%a in ('findvolsn 4278-8365') do backup %%a

The script follows, triple spaced to reveal line wrap:



@echo off


set _vol_sn_list=%*


if not defined _vol_sn_list goto :eof





rem searching for Volume Serial Number in LOCAL drives


for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do for /f
"skip=1 tokens=5" %%b in ('vol %%a: 2^>nul') do call :check_vol_sn %%a:
%%b





:get_unc_computers


rem searching for Volume Serial Number in NETWORK drives


rem parameters: none


rem scanning for all computer names in network (could take a few
minutes)





rem wake up the network


rem Share names found in the past were saved in the registry


rem so the other computers can be "awakened" by a DIR command.


for %%a in (%NETWORK_SHARE_LIST%) do for /l %%b in (1,1,10) do dir %%a
Post by JJ
nul 2>nul
set "_in_computer_list="


for /f "tokens=1-4" %%a in ('net view /network') do (


if /i "%%a %%b %%c %%d"=="The command completed successfully." set
"_in_computer_list="


if not defined _in_computer_list (


rem if output is "----------" then the next line is a computer name


set "_text=%%a"


call set "_text=%%_text:~0,10%%"


call set "_text=%%_text:----------=%%"


if not defined _text set _in_computer_list=TRUE


) else (


if /i not "%%~a"=="\\%computername%" (


set "_compname=%%a"


call set "_doubleback=%%_compname:~0,2%%"


call set "_doubleback=%%_doubleback:\\=%%"


if not defined _doubleback call :get_unc_shares %%a


)


)


)


if defined NETWORK_SHARE_LIST setx /M NETWORK_SHARE_LIST
"%NETWORK_SHARE_LIST%">nul


goto :eof





rem =========subroutines=========





:get_unc_shares


rem parameters: 1 = UNC computer (i.e. \\ASUS)


set "_in_share_list="


for /f "tokens=1-4" %%w in ('net view %1') do (


if /i "%%w %%x %%y %%z"=="The command completed successfully." set
"_in_share_list="


if not defined _in_share_list (


rem if output is "----------" then the next line is a computer name


set "_text=%%~w"


call set "_text=%%_text:~0,10%%"


call set "_text=%%_text:----------=%%"


if not defined _text set _in_share_list=TRUE


) else (


if "%%x"=="Disk" call :get_vol_sn "%~1\%%~w"


)


)


goto :eof





:get_vol_sn


rem parameters: 1 = UNC share (i.e. \\ASUS\BU1)


for /f "skip=1 tokens=1-5" %%l in ('dir %1 2^>nul') do (


if /i "%%l %%m %%n %%o"=="Volume Serial Number is" call :check_vol_sn
%1 %%p


)


echo;%NETWORK_SHARE_LIST% | find /i "%~1">nul


if errorlevel 1 set NETWORK_SHARE_LIST=%NETWORK_SHARE_LIST% %1


goto :eof





:check_vol_sn


rem parameters: 1 = UNC share 2 = volume serial number


echo %_vol_sn_list% | find /i "%2" >nul 2>nul


if not errorlevel 1 echo Found %2 in %1


goto :eof


--
Tom Del Rosso
2024-09-27 08:17:21 UTC
Permalink
Post by JJ
I think this is a problem in the network communication part, where the
response timeout is too low. The problem is common in Windows (all
versions; even if power management is not interfering), but rarely
occur in Linux. So if there is a setting for that timeout, it would
be my prime suspect.
Windows has a timeout that's too short? Incredible.

Most Windows timeouts seem to be like Robocopy, which defaults to
re-trying to copy a file every 30 seconds if it is unable to read it. It
does this a default 1 million times, so unless you specify different
numbers on the command line, it will retry a file for a few days less
than a year before going on to the next file.
--
Defund the Thought Police
Mr. Man-wai Chang
2024-09-24 15:07:34 UTC
Permalink
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
NET VIEW /NETWORK
This commmand relies on SMB 1.0, which is disabled (if not deprecated)
in Windows 10 and 11. You need to enable SMB 1.0 first in Windows Features.

I dunno whether there is a Micro$ft successor to that command for newer
SMB versions. :)
Paul
2024-09-25 00:42:24 UTC
Permalink
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
NET VIEW /NETWORK
This commmand relies on SMB 1.0, which is disabled (if not deprecated) in Windows 10 and 11. You need to enable SMB 1.0 first in Windows Features.
I dunno whether there is a Micro$ft successor to that command for newer SMB versions. :)
I have a test install, and with SMB 1.0 turned on, rebooted and messing about
multiple times in services.msc , "net view" is *still* returning
a complaint about "some service" is not started (2184). Of course,
it does not say which service. Which is Microsofts definition of "fun".

The file sharing troubleshooter (only available via searching for it),
does not help.

I bet I need to reinstall.

Amiright, MWC ? :-) OK, reinstall complete, picture below.

It is easier to just write the names on a slip
of paper and tape the paper to the side of the monitor
for future reference.

Let's see, there is "Sleepy", "Dopey", "Bashful"...

I can see why the machine does not want to connect to them.

[Picture]

Loading Image...

Paul
Mr. Man-wai Chang
2024-09-25 10:58:19 UTC
Permalink
Post by Paul
It is easier to just write the names on a slip
of paper and tape the paper to the side of the monitor
for future reference.
Let's see, there is "Sleepy", "Dopey", "Bashful"...
I can see why the machine does not want to connect to them.
It's called network browser, possibly related to the old NETBIOS over
TCP/IP.

The problem complicates when you wanna do the same in Linux using Samba
or the kernel-mode Samba. The complication also applies to iOS, Android
and MacOS. :)
Kenny McCormack
2024-09-25 13:30:15 UTC
Permalink
In article <vcvm9h$3d78b$***@dont-email.me>, Paul <***@needed.invalid> wrote:
...
Post by Paul
It is easier to just write the names on a slip
of paper and tape the paper to the side of the monitor
for future reference.
I can't remember the original parameters of this issue/thread. Is OP open
to 3rd party solutions?

If so, I wonder if there is a Windows port of "nmap". There probably is
(no reason why there should not be) and that may solve OP's problem.

Meta note: I see this is cross-posted.
I am reading/posting from alt.msdos.batch.nt
--
Faced with the choice between changing one's mind and proving that there is
no need to do so, almost everyone gets busy on the proof.

- John Kenneth Galbraith -
Mr. Man-wai Chang
2024-09-25 13:49:36 UTC
Permalink
Post by Kenny McCormack
Meta note: I see this is cross-posted.
I am reading/posting from alt.msdos.batch.nt
"NET VIEW" can also be a batch command... Well... :)
Frank Slootweg
2024-09-25 15:09:35 UTC
Permalink
Post by Mr. Man-wai Chang
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
NET VIEW /NETWORK
This commmand relies on SMB 1.0, which is disabled (if not deprecated)
in Windows 10 and 11. You need to enable SMB 1.0 first in Windows Features.
I dunno whether there is a Micro$ft successor to that command for newer
SMB versions. :)
I'm not subscribed to alt.msdos.batch.nt, so had to lookup the OP.

As this NET VIEW stuff is rather a flimsy/brittle mess on modern
Windows systems, the OP (Tom Del Rosso) may want to have a look at
NirSoft's NetResView.

<https://www.nirsoft.net/utils/netresview.html>

"NetResView is a small utility that displays the list of all network
resources (computers, disk shares, and printer shares) on your LAN. As
opposed to "My Network Places" module of Windows, NetResView display
all network resources from all domains/workgroups in one screen, and
including admin/hidden shares."

Hope this helps.
Ammammata
2024-09-26 06:47:06 UTC
Permalink
Frank Slootweg wrote on 25/09/2024 :
<https://www.nirsoft.net/utils/netresview.html>

I compared this with the above soft perfect network scanner

the nirsoft tool misses almost all computers in the network; it lists
the servers (not all of them) , the printers (not all of them), all the
NAS, some VMs and my computer

right now didn't detect at least 6 computers (a couple of them could be
off)
--
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
-=- -=- -=- -=- -=- -=- -=- -=- - -=-
........... [ al lavoro ] ...........
wasbit
2024-09-26 08:42:11 UTC
Permalink
Post by Frank Slootweg
<https://www.nirsoft.net/utils/netresview.html>
I compared this with the above soft perfect network scanner
the nirsoft tool misses almost all computers in the network; it lists
the servers (not all of them) , the printers (not all of them), all the
NAS, some VMs and my computer
right now didn't detect at least 6 computers (a couple of them could be
off)
Is that the paid for version of the Softperfect Network Scanner or the
free unlimited duration trial with maximum of 10 devices displayed?

- https://www.softperfect.com/products/networkscanner/
--
Regards
wasbit
Ammammata
2024-09-26 10:07:35 UTC
Permalink
Is that the paid for version of the Softperfect Network Scanner or the free
unlimited duration trial with maximum of 10 devices displayed?
- https://www.softperfect.com/products/networkscanner/
re-read my post, the link points to version 6.2.1

https://filehippo.com/download_softperfect-network-scanner/6.2.1/

note: it's an old version, the last free trial to use that shows all
the info
--
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
-=- -=- -=- -=- -=- -=- -=- -=- - -=-
........... [ al lavoro ] ...........
Tom Del Rosso
2024-09-27 08:25:03 UTC
Permalink
Post by Frank Slootweg
I'm not subscribed to alt.msdos.batch.nt, so had to lookup the OP.
As this NET VIEW stuff is rather a flimsy/brittle mess on modern
Windows systems, the OP (Tom Del Rosso) may want to have a look at
NirSoft's NetResView.
<https://www.nirsoft.net/utils/netresview.html>
Thanks but the need was for a CLI command. That's why I posted in
batch.nt but somebody cross-posted his reply.

The other CLI utility I know of is PSEXEC from Sysinternals.

psexec \\* cmd /c set computername

That command works every time in a Windows domain.
--
Defund the Thought Police
Tom Del Rosso
2024-09-27 08:26:27 UTC
Permalink
Post by Tom Del Rosso
That command works every time in a Windows domain.
...but not in Win 7 I meant to say.
--
Defund the Thought Police
Frank Slootweg
2024-09-27 10:08:01 UTC
Permalink
Post by Tom Del Rosso
Post by Frank Slootweg
I'm not subscribed to alt.msdos.batch.nt, so had to lookup the OP.
As this NET VIEW stuff is rather a flimsy/brittle mess on modern
Windows systems, the OP (Tom Del Rosso) may want to have a look at
NirSoft's NetResView.
<https://www.nirsoft.net/utils/netresview.html>
Thanks but the need was for a CLI command. That's why I posted in
batch.nt but somebody cross-posted his reply.
NetResView doesn't only have a GUI, but can also save the list of
network resources to a file in several formats (text, tab-delimited
text, comma-delimited text, etc.), so you can process that output in a
batch file. It also has command-line options for specifying what type
of info is/is-not generated. So perhaps a little less elegant than a
pure CLI command, but quite workable.

[...]
Tom Del Rosso
2024-09-27 11:56:18 UTC
Permalink
Post by Frank Slootweg
NetResView doesn't only have a GUI, but can also save the list of
network resources to a file in several formats (text, tab-delimited
text, comma-delimited text, etc.), so you can process that output in a
batch file. It also has command-line options for specifying what type
of info is/is-not generated. So perhaps a little less elegant than a
pure CLI command, but quite workable.
[...]
Thanks. I'll try that.
--
Defund the Thought Police
Andy Burns
2024-09-27 12:10:01 UTC
Permalink
Post by Tom Del Rosso
Post by Frank Slootweg
NetResView doesn't only have a GUI, but can also save the list of
network resources to a file in several formats (text, tab-delimited
text, comma-delimited text, etc.), so you can process that output in a
batch file. It also has command-line options for specifying what type
of info is/is-not generated. So perhaps a little less elegant than a
pure CLI command, but quite workable.
[...]
Thanks. I'll try that.
or within cmd window, try nbtstat with various flags, I forget which do
what, no doubt /? shows help
Tom Del Rosso
2024-09-29 19:58:49 UTC
Permalink
Post by Frank Slootweg
Post by Tom Del Rosso
Post by Frank Slootweg
I'm not subscribed to alt.msdos.batch.nt, so had to lookup the OP.
As this NET VIEW stuff is rather a flimsy/brittle mess on modern
Windows systems, the OP (Tom Del Rosso) may want to have a look at
NirSoft's NetResView.
<https://www.nirsoft.net/utils/netresview.html>
Thanks but the need was for a CLI command. That's why I posted in
batch.nt but somebody cross-posted his reply.
NetResView doesn't only have a GUI, but can also save the list of
network resources to a file in several formats (text, tab-delimited
text, comma-delimited text, etc.), so you can process that output in a
batch file. It also has command-line options for specifying what type
of info is/is-not generated. So perhaps a little less elegant than a
pure CLI command, but quite workable.
I tested it and found that at those random times when the peer-to-peer
network is in a state that prevents the NET VIEW command from detecting
the other machines, NetResView is also unable to see them. So all 3 of
these commands fail at the same times.

NET VIEW
PSEXEC
NetResView

I don't know yet what makes that happen. Right now I can't make it
happen again, but when it does I have some things to try like restarting
services.
--
Defund the Thought Police
Frank Slootweg
2024-09-30 09:13:01 UTC
Permalink
Post by Tom Del Rosso
Post by Frank Slootweg
Post by Tom Del Rosso
Post by Frank Slootweg
I'm not subscribed to alt.msdos.batch.nt, so had to lookup the OP.
As this NET VIEW stuff is rather a flimsy/brittle mess on modern
Windows systems, the OP (Tom Del Rosso) may want to have a look at
NirSoft's NetResView.
<https://www.nirsoft.net/utils/netresview.html>
Thanks but the need was for a CLI command. That's why I posted in
batch.nt but somebody cross-posted his reply.
NetResView doesn't only have a GUI, but can also save the list of
network resources to a file in several formats (text, tab-delimited
text, comma-delimited text, etc.), so you can process that output in a
batch file. It also has command-line options for specifying what type
of info is/is-not generated. So perhaps a little less elegant than a
pure CLI command, but quite workable.
I tested it and found that at those random times when the peer-to-peer
network is in a state that prevents the NET VIEW command from detecting
the other machines, NetResView is also unable to see them. So all 3 of
these commands fail at the same times.
NET VIEW
PSEXEC
NetResView
Yes, I was afraid that would be the case.

I have only a small network, mostly two computers and a NAS, so I know
the NetBIOS names and can check things with nbtstat (-n and -r (and, if
needed, -a and -R or -RR)), but for a bigger network or/and unknown
NetBIOS names, that's of course not feasible.
Post by Tom Del Rosso
I don't know yet what makes that happen. Right now I can't make it
happen again, but when it does I have some things to try like restarting
services.
Good luck.
Andy Burns
2024-09-30 09:24:37 UTC
Permalink
Post by Frank Slootweg
I have only a small network, mostly two computers and a NAS, so I know
the NetBIOS names and can check things with nbtstat
On a large network, there will almost always be multiple domain
controllers (often with WINS installed) and due to higher votes, these
will tend to win subnet and domain master browser elections, giving
stability.

On small networks, there won't tend to be server versions of Windows,
just desktop versions, and possibly samba on NASes, and machines will be
"off" more of the time,therefore you don't get a stable master browser
hence unreliable NETBIOS name resolution, machines end-up trying broadcasts
Paul
2024-09-30 10:49:49 UTC
Permalink
   I have only a small network, mostly two computers and a NAS, so I know
the NetBIOS names and can check things with nbtstat
On a large network, there will almost always be multiple domain controllers (often with WINS installed) and due to higher votes, these will tend to win subnet and domain master browser elections, giving stability.
On small networks, there won't tend to be server versions of Windows, just desktop versions, and possibly samba on NASes, and machines will be "off" more of the time,therefore you don't get a stable master browser hence unreliable NETBIOS name resolution, machines end-up trying broadcasts
But shouldn't elections settle down after two elections ?
Assuming all nodes stay connected and their network connection
does not power off.

.\nbtscan-1.0.35.exe 192.168.2.0/24
192.168.2.103 WORKGROUP\CHEVRON SHARING
*timeout (normal end of scan)

net view
Server Name Remark

-------------------------------------------------------------------------------
\\CHEVRON
\\WALLACE
The command completed successfully.

Symptoms vary. nbtscan "cannot see itself".

Net View can see itself.

But two Win 11 machines don't behave the same way on Net View.

I suspect a random number generator is involved
in the code somewhere :-)

Paul
Bernard Peek
2024-10-06 17:43:06 UTC
Permalink
Post by Mr. Man-wai Chang
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
NET VIEW /NETWORK
This commmand relies on SMB 1.0, which is disabled (if not deprecated)
in Windows 10 and 11. You need to enable SMB 1.0 first in Windows Features.
Hopefully remembering to disable it again immediately afterwards. It's
disable for a reason.
--
Bernard Peek
***@shrdlu.com
Wigan
Mr. Man-wai Chang
2024-10-14 11:32:22 UTC
Permalink
Post by Bernard Peek
Post by Mr. Man-wai Chang
Post by Tom Del Rosso
NET VIEW /NETWORK
This commmand relies on SMB 1.0, which is disabled (if not deprecated)
in Windows 10 and 11. You need to enable SMB 1.0 first in Windows Features.
Hopefully remembering to disable it again immediately afterwards. It's
disable for a reason.
Because SMB 1.0 is not secured enough. But some really old
scripts/programs might still rely on NET VIEW. Dunno....

Bernard Peek
2024-10-06 17:40:32 UTC
Permalink
Post by Tom Del Rosso
This is easy in a domain, but the problem is peer-to-peer at home.
If your router is a DHCP server it probably has a list of IPs and possibly
names.
--
Bernard Peek
***@shrdlu.com
Wigan
Loading...