IT tutorials
 
Technology
 

Windows Server 2008 : Manipulating Shares with net share, Mapping Drives with net use

8/21/2013 4:40:00 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

1. Manipulating Shares with net share

You can create shares from the command prompt with the net share command. The basic syntax is

net share sharename = drive:path

The following table describes some common uses with the net share command.

net share CommandsComments
View shares.
c:\>net share

Shows a listing of all shares on the local system.
Create a share.
c:\>net share data=c:\data

Creates a share named data from the folder named c:\data. The Everyone group is granted Read permission by default.

Note

This is another one of those commands that is particular about the equal sign (=). There shouldn’t be any spaces before or after the equal sign.

Delete a share.
/delete
c:\>net share data /delete

The /delete switch deletes the named share. In this example, the share named data created in the previous step is deleted.
Create a share with specified permissions.
/grant: user, [read | change |
full ]
c:\>net share data=c:\data
/grant:darril,full
c:\>net share data=c:\data
/grant:"authenticated users",full

You can modify the default permissions by using the /grant switch and specifying a user and the desired share permission. You can specify a user or a group. If the user or group name includes a space, it must be enclosed in quotes.

Note

Only the specified user or group is granted permissions. In other words, the default of Everyone being granted Read permission is not used.

2. Mapping Drives with net use

There might be times when you’ll want to manipulate or access files on a remote share. You can use the Universal Naming Convention (UNC) of \\servername\sharename. However, some commands don’t recognize the UNC path and need a drive letter, and sometimes it’s just easier to use a drive letter instead of a full UNC path. You can use the net use command to map drive letters to UNC paths. The basic syntax is

net use x: \\serverName\shareName

You can use any drive letter that is not in use on the system, but if the drive letter is in use, the command will fail. Additionally, the UNC path must be reachable or you’ll get an error.

net use CommandDescription
c:\>net use

You can view all currently mapped drives with this command.
c:\>net use z: \\fs1\public

This maps the driver letter z: to a share named public on a remote host named fs1.
/delete
c:\>net use z: /delete

The /delete switch deletes the mapped drive and frees up the mapped drive letter.
/persistent
c:\>net use /persistent: No

c:\>net use /persistent: Yes

The /persistent switch is used by itself and specifies whether the mapped drives are remembered at the next logon. When set to no, the net use command includes the following line: “New connections will not be remembered.” This is the default. When set to Yes, the net use command includes the following line: “New connections will be remembered.” Mapped drives will survive reboots.

Tip

If mapping a drive from a script that you want to survive reboots, it’s best to enable persistent connections, map the drive, and then turn off persistent connections.

 
Others
 
- Windows Server 2008 : Manipulating Shadow Copies with vssadmin
- Windows 7 : Disk Management (part 3) - Creating a Striped Volume, Creating and Attaching VHDs
- Windows 7 : Disk Management (part 2) - Dynamic Disk Management, Extending a Disk, Creating a Spanned Volume
- Windows 7 : Disk Management (part 1) - Assigning Drive Letters and Joining Volumes
- Windows 7 : Managing Hard Disks - The Nature of Hard Disks,Windows 7 File and Storage Systems
- SharePoint 2010 : Scaling out Search — adding a property database
- SharePoint 2010 : Scaling out Search — adding a query component
- SharePoint 2010 : Managing Search Service
- SharePoint 2010 : Setting up Search Service
- Windows Server 2012 : Deploying Servers - Deploying images
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us