When Secure Copy Protocol (SCP) is enabled on the PowerShell Server, an SCP client can connect
and upload or download files. Below is a description of a variety of common methods used to
send and receive files over SCP with the PowerShell Server.
Enabling SCP
By default, the PowerShell Server does not allow SCP connections. This is easily enabled in the server interface using the following steps:
- On the Connection tab simply check the box that says "Enable Secure Copy Protocol (SCP) Support".
- Then click Save Changes and Restart to restart the server with this change.
That is all that is required to enable SCP support. Now you can connect using any of the methods described below.
SCP From PowerShell Server Cmdlets
Included with the PowerShell Server are several cmdlets, including Get-PowerShellServerFile and Send-PowerShellServerFile.
These two cmdlets will allow you to send and receive files from PowerShell Server when SCP is enabled.
The usage is very simple. For example:
Uploading a File
PS> Send-PowerShellServerFile -Server YourServer -RemoteFile C:\temp\test.txt
-LocalFile C:\downloads\test.txt
Downloading a File
PS> Get-PowerShellServerFile -Server YourServer -RemoteFile C:\uploads\test.txt
-LocalFile C:\temp\test.txt
Notes:
As of PowerShell Server V5 the default authentication mechanism when using the Send-PowerShellServerFile and Get-PowerShellServerFile cmdlets is GSSAPI using NTLM and Kerberos.
When the client and server machine are on the same domain, and the user is a member of the appropriate security group, this means that no explicit authentication parameters are required.
While this is convenient, if you need to use regular password authentication and specify the user and password when connecting this can be done by specifying the AuthMode, User, and Password parameters. For instance:
PS> Send-PowerShellServerFile -Server YourServer -AuthMode password -User MyUser
-Password MyPassword -RemoteFile C:\temp\test.txt -LocalFile C:\downloads\test.txt
SCP From Linux
The command line SCP client in Linux can also be used to send and get files.
Uploading a File
test@server:~/> scp -oUser=DOMAIN\\user ./test.txt hostname:c:\\temp\\test.txt
Downloading a File
test@server:~/> scp -oUser=DOMAIN\\user hostname:c:\\temp\\test.txt ./test.txt
Notes:
In the above examples two special requirements are demonstrated.
- When using SCP on Linux and need to authenticate with a windows domain username you must explicitly set the username using -oUser as above.
- Paths containing backslashes must be escaped with another backslash.
RootAdmin
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.