Skip to content

Instantly share code, notes, and snippets.

@jamesantrobus
Created November 4, 2013 14:10
Show Gist options
  • Save jamesantrobus/7302989 to your computer and use it in GitHub Desktop.
Save jamesantrobus/7302989 to your computer and use it in GitHub Desktop.
Copy file to remote server with PowerShell
$user = "\myusername"
$pass = ConvertTo-SecureString -String "supersecretpassword" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential
-ArgumentList $user ,$pass
New-PSDrive -Name myshare -PSProvider FileSystem -Root \\remoteserver\some-share -Credential $cred
Copy-Item C:\Users\James\test.txt myshare:\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment