Solution
the solution to this issue has been found. For you information, if you use the SFTP scrip posted on the WINSCP site you will need to add the lines below in bold.
For some reason when the path to the Key and the passphrase was added it started to work. The parts in bold were added to resolve. (Parts in red are variables specific to your solution)
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "sftp.XXXXXXXX.com"
UserName = "USERNAME"
PrivateKeyPassphrase = "XXXXXXXXXXX"
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
SshPrivateKeyPath = "C:\Keys\PRIVATEKEY.ppk"
}
For some reason when the path to the Key and the passphrase was added it started to work. The parts in bold were added to resolve. (Parts in red are variables specific to your solution)
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "sftp.XXXXXXXX.com"
UserName = "USERNAME"
PrivateKeyPassphrase = "XXXXXXXXXXX"
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
SshPrivateKeyPath = "C:\Keys\PRIVATEKEY.ppk"
}