Re: Scripting download and installation of .Net assembly
Download the file from SourceForce, as shown here:
Resume uploading with built-in Windows FTP client
Resume uploading with built-in Windows FTP client
Save-Module -Name WinSCP -Path $destination\
Install-Module -Name WinSCP -Force
Import-Module -Name WinSCP
Add-Type -Path "$destination\WinSCP\5.9.6.0\lib\WinSCPnet.dll"
$session = New-Object WinSCP.Session
$session.ExecutablePath = "$destination\WinSCP\5.9.6.0\bin\WinSCP.exe"
SessionOptions
(including all credentials) and doesn't require a download from the WinSCP website. The only downside is that there is a hardcoded version number in there which should be changed when there is a new version.
$source = "https://winscp.net/download/WinSCP-5.9.6-Automation.zip/download"
$filename = "$destination\winscp.zip"
(New-Object System.Net.WebClient).DownloadFile($source, $filename)