Created
November 4, 2013 14:10
-
-
Save jamesantrobus/7302989 to your computer and use it in GitHub Desktop.
Copy file to remote server with PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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