# Super-secret credentials...
$network_user = "domain\user"
$network_password = "monkey123"
# Where do we want to connect to - note: do not use a trailing \
$remotepath = "\\server\path"
# Convert to a secure string...
$PWord = ConvertTo-SecureString $network_password -AsPlainText -Force
# .. and create a credential object
$myCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $network_user,$PWord
# Map a drive to the network path...
New-PSDrive -Name Z -PSProvider FileSystem -Root $remotepath -Credential $myCreds
# Query the remote path - note we're NOT using the mapped drive...
Get-ChildItem $remotepath
# Call other commands against $remotepath...