# Access Network Location – PowerShell

In order to access a network location in PowerShell, we need to temporary map it to a drive locally, which we can then use as a reference for our further operation.

For ex, here, I want to copy a SharePoint package from a shared network location to my local machine.

If (!(Test-Path Z:))
{
write-host "Attempting to map network drive, Z:" -foregroundcolor Magenta

\$map = new-object -ComObject WScript.Network
}
else
{
write-host "Z: mapping already exist" -foregroundcolor Green
}

# Copy the package from network location to local drive
write-host "copying wsp file" -ForegroundColor Magenta

Copy-Item Z:\SharePointWebPart.wsp P:\Piyush\SharePointWebPart.wsp -force

I have mapped the network location to Z: which is then used as a source location.