In today’s world, there are so many different devices and applications that it can be hard to keep track of which ones are connected to your network. PowerShell can help you do just that. First, let’s take a look at how PowerShell works. PowerShell is a command-line tool that you use to manage your computer systems. It can be used to control all sorts of things, from the settings on your computer to the management of files and folders. One of the things PowerShell can do is map network drives. This is a way of saying that PowerShell can tell your computer which devices are connected to your network and which ones are not. This information can then be used to help you keep track of which applications are using which resources and which ones aren’t. To get started, open up a new cmd window and type “netstat -a”. This will show you all the connections and resources that are being used on your computer. You’ll see something like this: $netstat -a | grep inet | wc -l 8
In years past, automating network drive creation required the use of primitive batch files, luckily for us you can now do it through PowerShell.
Note: this tutorial expects that you are using PowerShell 3.0.
How to Map Network Drives Using PowerShell
Prior to the PowerShell era, we could map networks drives using a batch file that contained a net use command:
To do it in PowerShell, press the Win + R keyboard combination to bring up a run box, then type powershell and hit enter.
The Cmdlet we are looking for is New-PSDrive, but most importantly you need use the -Persist switch.
Just change the name to a valid (not in use) drive letter and point the root parameter to a valid network share.
That’s all there is to it.