Map a network drive on Windows Server Core

Map a network drive on Windows Server Core
Photo by Andrew M / Unsplash

Using Server Core and realised you can't go into Windows Explorer to map a drive? Here's how to map drives on Windows Server Core.

Windows Server Core is a great choice of OS if you're trying to use as few system resources as possible, or you want a system that presents a smaller security risk, but some tasks that are second nature on the Desktop Experience equivalent can make you stop and think.

Browsing to a UNC path is one such thing, but fortunately, the same command line method that can be used on all other Windows OSs works on Server Core too.

To map a drive, use the net use command.

Browse to the UNC path

The following will initiate a connection to the storage path, and authenticate using the specified details.

net use \\servernameorIP\share /user:username password

If you're logged in using a domain account (or a local account that matches a user/password on the storage system), you can ignore the /user:username password part.

Once it has authenticated, you can use the cd command to change to that directory and browse the contents:

cd \\servernameorIP\share

dir ## <- lists the directory contents

Mapping a drive

Mapping a drive can be more useful as you can then refer to the mapped letter for any further commands. You'll need to pick a drive letter that's not in use, but besides that, the command is largely the same as above. Use /persistent if you want the drive to re-map at each login.

net use T: \\servernameorIP\share /user:username password

net use T: \\servernameorIP\share /user:username password /persistent

Now you can browse to the share, and list the contents as before, but using the assigned drive letter.

cd T:

dir

That's it! That's the basic stuff for net use, and of course, it's as applicable to desktop experience Windows versions as Server Core. Do you know of any useful net use tidbits? Let me know below, or over at @techbitsio.



Great! Next, complete checkout for full access to techbits.io
Welcome back! You've successfully signed in
You've successfully subscribed to techbits.io
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated