Windows – Explain Windows “net view” command switches

windows

Can someone please explain the difference between these commands.

net view
net view /all
net view /domain
net view /all /domain

Best Answer

From net help view:

C:\Users\shufler>net help view
The syntax of this command is:

NET VIEW
[\\computername [/CACHE] | [/ALL] | /DOMAIN[:domainname]]

NET VIEW displays a list of resources being shared on a computer. When used
without options, it displays a list of computers in the current domain or
network.

\\computername             Is a computer whose shared resources you want
                           to view.
/DOMAIN:domainname         Specifies the domain for which you want to
                           view the available computers. If domainname is
                           omitted, displays all domains in the local area
                           network.
/CACHE                     Displays the offline client caching settings for
                           the resources on the specified computer
/ALL                             Displays all the shares including the $ shares

So let's look at each.

net view returns the computers in the current domain or network. This list will only show computers that have file and printer sharing enabled.
net view /all shows all shares available, including administrative shares like C$ and admin$
net view /domain:contoso.com will list all of the sharing computers in the contoso.com domain
net view /all /domain shows all shares (regular and administrative) in the domain

I'm not currently connected to a domain so unfortunately I can't provide you with examples.

Related Question