Login with 2 key factor RSA Token
I am using the Winscpnet.dll for the first time.
Here's my code..
I keep getting an error access denied when I run the code below.
When I login through Winscp.com & Winscp.exe, providing the same hostname username password & Passcode I am able to login successfully
strWinSCPDllPath= (WINSCPNET.DLL path)
Set SCPSessionProtocol = DotNetFactory.CreateInstance("WinSCP.Protocol", strWinSCPDllPath)
Set SCPSessionOptions = DotNetFactory.CreateInstance("WinSCP.SessionOptions", strWinSCPDllPath )
Set SCPSession = DotNetFactory.CreateInstance("WinSCP.Session", strWinSCPDllPath)
'Setup session options
With SessionOptions
.Protocol = SessionProtocol.sFTP
.HostName = &Hostname
.UserName = &Username
.Password = (PASSCODE-RSA Token)
.GiveUpSecurityAndAcceptAnySshHostKey = true
.SshPrivateKeypassphrase = (PASSWORD)
End With
else
msgbox "Protocol not accepted"
End If
'Connect to the server
SCPSession.SessionLogPath= "Path"
SCPSession.Open SCPSessionOptions
If SCPSession.opened Then
msgbox " Connection Successful"
Else
msgbox "Connection failed: " & Err.Description
End If
Any help appreciated
Thanks
Rgee
Here's my code..
I keep getting an error access denied when I run the code below.
When I login through Winscp.com & Winscp.exe, providing the same hostname username password & Passcode I am able to login successfully
strWinSCPDllPath= (WINSCPNET.DLL path)
Set SCPSessionProtocol = DotNetFactory.CreateInstance("WinSCP.Protocol", strWinSCPDllPath)
Set SCPSessionOptions = DotNetFactory.CreateInstance("WinSCP.SessionOptions", strWinSCPDllPath )
Set SCPSession = DotNetFactory.CreateInstance("WinSCP.Session", strWinSCPDllPath)
'Setup session options
With SessionOptions
.Protocol = SessionProtocol.sFTP
.HostName = &Hostname
.UserName = &Username
.Password = (PASSCODE-RSA Token)
.GiveUpSecurityAndAcceptAnySshHostKey = true
.SshPrivateKeypassphrase = (PASSWORD)
End With
else
msgbox "Protocol not accepted"
End If
'Connect to the server
SCPSession.SessionLogPath= "Path"
SCPSession.Open SCPSessionOptions
If SCPSession.opened Then
msgbox " Connection Successful"
Else
msgbox "Connection failed: " & Err.Description
End If
Any help appreciated
Thanks
Rgee