Mapping a network drive allows you to assign a drive letter (e.g., Z:) to a shared folder on another computer or server. This makes it easier to access remote files as if they were stored locally. In Windows, you can map network drives using either Command Prompt (CMD) or PowerShell. This guide walks you through both methods.
Follow these steps to learn how to use both methods:
Method 1: Map a Network Drive Using Command Prompt
- Press ‘Windows + R’, type cmd in the Run box, and hit ‘Enter’.
- Type the command below in the Command Prompt window:
net use Z: \\ServerName\SharedFolder /user:Domain\Username Password
- Z: ? Drive letter you want to assign.
- \ServerName\SharedFolder ? Path to the shared network location.
- /user:Domain\Username ? Your login credentials (if required).
- Password ? Your password for the shared resource.
- Example:
net use Z: \\192.168.1.10\Backups /user:Admin MyPassword123
- Press Enter. The drive will be mapped if the credentials are valid.
- To disconnect the mapped drive later, use:
net use Z: /delete
Method 2: Map a Network Drive Using PowerShell
- Press ‘Windows + X’, then click on Windows PowerShell (Admin) to open it.
- Enter the following command:
New-PSDrive -Name “Z” -PSProvider FileSystem -Root “\\ServerName\SharedFolder” -Persist -Credential (Get-Credential)
- -Name “Z” ? Drive letter.
- -Root “\ServerName\SharedFolder” ? Network path.
- -Persist ? Ensures the drive remains mapped after restart.
- -Credential (Get-Credential) ? Prompts for your username and password.
- Example:
New-PSDrive -Name “Z” -PSProvider FileSystem -Root “\\192.168.1.10\Backups” -Persist -Credential (Get-Credential)
- Enter your credentials when prompted. The drive will be mapped successfully.
- To remove the mapped drive in PowerShell, use:
Remove-PSDrive -Name “Z”
Common Use Cases in Hosting Environments
- Accessing remote backup locations from your Windows server.
- Mapping shared hosting resources provided by your hosting company.
- Connecting to centralised storage for logs, databases, or project files.
Conclusion
By using either CMD or PowerShell, you can quickly map network drives in Windows to simplify access to shared resources. For hosting environments, this is especially useful for connecting to remote storage, automating backups, or integrating file management.
Managing network drives for business use?
For better reliability and secure access, consider using a VPS hosting environment with dedicated resources.
For better reliability and secure access, consider using a VPS hosting environment with dedicated resources.
Want to integrate maps on your site too? Learn How to add google maps to WordPress with a Plugin