If you want to know what's happening with your network from the command line, one of your best tools
is the net command.
Now the net command and has been around like, well, forever.
Literally the first network command I learned in the mid 1980's was the net command. The net command even
predates windows.
It comes from the old Microsoft land manager, the first version of software that ran in DOS.
I mean this thing is old. But as old as it is, it has been updated and improved,
and you find it even on the most recent versions of Windows 10.
So let's take a quick tour and see what the net command can do for us now to help you out here what
I've got is I've got a system that is on a workgroup named workgroup and there's just a few other computers
out there so one of the first things we can do at the net command is run net view.
So for starters if you type.
Net by itself it'll give you some ideas of what you can type with that.
Now I'm not going to go through every one of these examples some of them are a little obsolescent but
we'll definitely do a number of these and let's do that net view.
So I'm going to start off by typing in net view.
And you can see I have a total of four systems that are on my work group.
I've got a computer called Mary, a computer called Studio, which is the machine right here,
I've got a machine called Windows 10 desktop VM, and I've got a printer. So running net view by itself
is a great way to make a quick and dirty look of what computers can my system see within my work group
itself.
Now from there we can do some interesting things for example one thing it's really important is to be
able to use Net User. A lot of times, you know,
who am I right now in terms of the networks so I can run net user and it's going to sit here and say
well I'm on the computer studio and my account is called Michael M and I am an administrator so just
a quick i forgot who I logged in as are what am I right now.
This is a great tool to use.
Just good ole net user.
So let's go and continue with net view.
Now at this time I'm going to type net view but instead of just typing that view I'm going to type the
actual name of the computer out there so let's go and do with 10 desktop V.M..
And now what we can see are the actual shares that are on that particular system.
So right now I have two folders shared on there one called Share me and the other one called users.
So with that you can do some pretty interesting stuff.
One of the things we can do is we can actually go through the process of mapping the drive using the
Net Use command.
So I'm going to type net use now when you map a drive what you're doing is you're assigning a drive
letter to that particular shared folder.
So in this case I'm going to pick an arbitrary drive letter that I know I'm not using in this case I'll
use w and then I just type in the name of the server which in this case is going to be win 10 desktop
VM.
And then I type the share name and you can see the share name is called share me.
Now two things to notice here.
First of all you'll see it says the command completed successfully so it worked.
The other thing is as you'll notice that I'm just typing in lowercase everything that you do with Windows
naming at this level is always converted to uppercase so doesn't really matter about case when you're
dealing with Windows.
However the interesting point is this I'm going to get to W and let's type dir.
And here's a file called Oh hi Donte.txt.
Hi Don.
You know you are so I can use the net command to simply access a shared resource.
Now we can turn that around just as easily what I want to do now is actually take a resource on my local
machine and share it out to the workgroup.
So if you take a look on the screen here you'll see I've got this folder called Donte.
And what I'm going to do is I'm going to offer that up for people to access.
So what I'm going to do is just type in the net command but this time I'm going to type in share.
So the first thing I do is I type in the name that I want to call it out on the network.
I'm going to call it Donte, I could call it anything I wanted, but we'll call it Donte.
And then I type in the name of the resource which in this case is going to be
just because I know it's on my desktop and then the actual name of the folder you can see it right there
is Donte and I hit enter and it can't find the file specified.
So you've got to be careful about dealing with the net command like any command like command.
If you don't type the command and right it's going to give you errors like this.
So if we take a look here I'm going to take-- where did I make a mistake?
Oh I see it.
I typed in user not users so I'm going to type in net share share name is going to be Donte equals C
colon backslash.
In fact I think I've got this in my.
Yeah I do.
I did a cut and paste so I know I got it right this time.
So that net share Donte equal C colon backslash users michaelm desktop Donte which is that folder right there.
We hit enter.
And Donte has now been successfully shared so anybody else if they want to they can go to their command
line and do a net use.
However this is also going to show up in their network folder just like any other shared resource
would through the graphical user interface.
Ok now it's a few other kind of unique commands that you might run into with the net command let me
run through those.
The first one is called Net accounts. Net accounts is a pretty handy way to get an idea of what type
of settings you have for all of your accounts.
So if we take a look here for example the minimum password age in days is zero so people can keep the
same password as long as they want maximum password age in days 180. Minimum password length.
So we have to have seven digits for a password.
So it gives you an idea for this individual local system how we have set up our accounts.
The last one is called net start. Now net start's a little bit dated but I would at least bring it up to
you. What you have is a bunch of network based services running on this system.
Now me normally I'm just going to run services dot msc if I need to start and stop services.
However if you need to you can do some stuff from here so I'm going to run net start and what it's showing
you right here are all of the different services that are network based that are running on this particular
system.
So if I want to I can turn something off let's pick something relatively safe.
I am going to turn off the World Wide Web publishing service so to do this I'm going to run the net
stop command and I can turn it off just by typing it in.
And I got to get it right so let's see if we get it right the first time.
When we look at that once to make sure I got it right.
And it's going to go ahead and stop my web server and I did have a web server running on this particular
system.
So the net command has been around for a long long time.
It is an incredibly powerful tool.
However in most cases my big use with the net command more than anything else is doing that.
NET VIEW you talk about a quick and dirty way to be able to see what's happening on your network from
the command line,
nothing is going to beat it.