# Converting the Windows Script Host MapNetworkDrive Method

### MapNetworkDrive

The truth is, Windows PowerShell doesn’t know how to map a network drive. Admittedly, you can use the New-PSDrive cmdlet to seemingly map a network drive within PowerShell; for example, this command creates a new PowerShell drive mapped to Z:

```
New-PSDrive -name Z -psprovider FileSystem -root \\atl-fs-001\public

```

This new PowerShell drive can be used exactly like any other mapped network drive as long as you are working in Windows PowerShell. Outside of PowerShell, however, this mapped drive is of no use: no one else, including the operating system, is even aware that it exists. That’s because this is a PowerShell drive and not a true mapped drive.

So is there a way to map a network drive from within PowerShell? Sure, as long as you’re willing to use the command-line utility Net.exe. The following command creates a real network drive (Z:), a drive mapped to \\atl-fs-001\public:

```
net use z: \\atl-fs-001\public

```