Page 1 of 1

NET VIEW alternative for Win10

Posted: 2021-Sep-25, 4:50 am
by alexo
Apparently the NET VIEW (without parameters) functionality is dependent on the insecure and deprecated SMB1 protocol, which is disabled by recent versions of Windows 10 (mine is 20H2).
Windows Explorer works just fine without it but I am trying to get a list of computers on the network (their NETBIOS names) on the command line, and getting:

Code: Select all

> net view
System error 1231 has occurred.
The network location cannot be reached. For information about network troubleshooting, see Windows Help.
Is there an alternative?

Thank you!

Re: NET VIEW alternative for Win10

Posted: 2021-Sep-25, 12:23 pm
by Simon Sheppard
There is an alternative using PowerShell on the NET View page:
https://ss64.com/nt/net-view.html

I don't think there is a simple replacement for the domain wide search, but then on anything but the smallest of domains NET VIEW often failed to give complete information anyway.

Re: NET VIEW alternative for Win10

Posted: 2021-Sep-25, 12:44 pm
by alexo
This is a home network, I am not on a domain.

Re: NET VIEW alternative for Win10

Posted: 2021-Sep-25, 12:56 pm
by Simon Sheppard
if you still have to use Explorer Network in home and small business workgroup environments to locate Windows-based computers, you can follow these steps on your Windows-based computers that no longer use SMBv1:
  1. Start the "Function Discovery Provider Host" and "Function Discovery Resource Publication" services, and then set them to Automatic (Delayed Start).
  2. When you open Explorer Network, enable network discovery when you are prompted.
All Windows devices within that subnet that have these settings will now appear in Network for browsing. This uses the WS-DISCOVERY protocol. Contact your other vendors and manufacturers if their devices still don't appear in this browse list after the Windows devices appear.
From:
https://docs.microsoft.com/en-us/window ... in-windows

Re: NET VIEW alternative for Win10

Posted: 2021-Sep-25, 1:14 pm
by alexo
As I wrote in the original post, I already see the devices in Explorer. I am trying to get them on a command line.

Re: NET VIEW alternative for Win10

Posted: 2021-Sep-26, 1:03 am
by alexo
Success!

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion
for /f "skip=3 tokens=1,3" %%a in ('arp -a') do (
  set ip=%%a
  if "%%b" == "dynamic" if not "!ip:~0,7!" == "169.254" (
    for /f "skip=8 tokens=1-3" %%b in ('nbtstat -A %%a') do (
      if "%%c" == "<00>" if "%%d" == "UNIQUE" echo %%a	%%b
)))
The spacing in the echo is a TAB character to make the columns align.

It is slow, since arp displays non-NETBIOS devices as well, and nbtstat takes its sweet time to fail on them. I tried to filter the obvious ones out.

It's ugly as frell but it works.

Improvements are welcome.