SSH + SCP using PowerShell

Analysis
Dec 6, 20071 min

It seemed like a simple enough task, write a PowerShell script to SCP files to a Unix server.  There is just one problem.  The .NET Framework doesn’t have a native way for doing this.  That is why when I found “SharpSSH – A Secure Shell (SSH) library for .NET“, I thought that I might have a solution.  So I set out to test things out:

$Null = [System.Reflection.Assembly]::LoadFrom(“D:ScriptTamir.SharpSSH.dll”)

$SCP = New-Object Tamir.SharpSsh.scp “myhost”, “myuser”, “mypassword”

$SCP.connect()

That’s when things went south, because I got the following when trying to connect to the Unix server:

“System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.”

Ahhhhhh… crap…  Looks like there is a fix, but it appears that is for the .NET Framework 3.0.  But, considering that the Tamir.SharpSsh stuff is using the Mentalis.org Security Library which appears to be based on 2.0 Framework I had to find another way to do SCP.

My solution was to script around my problem using WinSCP.  Not the best method, but I’m almost done.  I will post the script up once I’m finished.  But, if anyone has any suggestions… I’m game.