Guest User

Untitled

a guest
Jan 23rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. # Load WinSCP .NET assembly
  2. Add-Type -Path "WinSCPnet.dll"
  3.  
  4.  
  5. # Declare variables
  6. $date = Get-Date
  7. $dateStr = $date.ToString("yyyyMMdd")
  8. #$fileDirectory = "\abicfs2appsCoverageVerifier"
  9. #$filePath = "\abicfs2appsCoverageVerifiercvgver." + $dateStr + ".0101"
  10. $filePath = "\empqaapp1coverageverifier_scriptsCoverageVerifiercvgver.20190121.0101"
  11.  
  12. # Write-Output $filePath
  13.  
  14. # Set up session options
  15. $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
  16. Protocol = [WinSCP.Protocol]::Sftp
  17. HostName = "secureftp.iso.com"
  18. UserName = "account"
  19. Password = "password"
  20. SshHostKeyFingerprint = "ssh-rsa 2048 8C1lwAjxCNRF6B4kbPIeW52/GB+98FmLMt0AJNf/Sf4="
  21. }
  22.  
  23. #$sessionOptions.AddRawSettings("FSProtocol", "2")
  24.  
  25. $session = New-Object WinSCP.Session
  26. # $session.SessionLogPath = "\shareappsCoverageVerifierUploadLog.log"
  27.  
  28.  
  29. try
  30. {
  31. # Connect
  32. $session.Open($sessionOptions)
  33.  
  34. # Transfer files
  35. $session.PutFiles($filePath,"/").Check()
  36. }
  37. finally
  38. {
  39. $session.Dispose()
  40. }
Add Comment
Please, Sign In to add comment