netstack

Powershell

Map network drive

$username = "domain\username"
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
New-PSDrive -Name "DriveLetter" -PSProvider FileSystem -Root "\\server\share" -Credential $credential -Persist

Alternatively, Get-Credential can be used to prompt for credentials:

$credential = Get-Credential
New-PSDrive -Name "DriveLetter" -PSProvider FileSystem -Root "\\server\share" -Credential $credential -Persist