Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key exchange negotiation failed #353

Closed
benchisler opened this issue Nov 3, 2020 · 10 comments
Closed

Key exchange negotiation failed #353

benchisler opened this issue Nov 3, 2020 · 10 comments

Comments

@benchisler
Copy link

When running this script in interactive mode in PowerShell ide it connects and transfers files. When using the same user as a scheduled task I get the "Key exchange negotiation failed"

Define Serve Name

$ComputerName = "where.my.server.is"

Define UserName

$UserName = "user.name"

#Define the Private Key file path
$KeyFile = "C;\helpdesk.txt"
$nopasswd = new-object System.Security.SecureString

#Set Credetials to connect to server
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $nopasswd)

Set local file path, SFTP path, and the backup location path which I assume is an SMB path

$FilePath = "$SharePath"
$SftpPath = '.'

Establish the SFTP session

$SFTPSession = New-SFTPSession -ComputerName $ComputerName -Credential $Credential -KeyFile $KeyFile -Port 22 -AcceptKey

Upload the file to the SFTP path

Set-SFTPFile -SessionId $SFTPSession.SessionID -LocalFile $FilePath -RemotePath $SftpPath -Overwrite

Disconnect SFTP session

$SFTPSession.Disconnect()

any suggestions?

@darkoperator
Copy link
Owner

darkoperator commented Nov 3, 2020 via email

@benchisler
Copy link
Author

benchisler commented Nov 3, 2020 via email

@darkoperator
Copy link
Owner

darkoperator commented Nov 3, 2020 via email

@benchisler
Copy link
Author

benchisler commented Nov 3, 2020 via email

@darkoperator
Copy link
Owner

darkoperator commented Nov 3, 2020 via email

@benchisler
Copy link
Author

benchisler commented Nov 4, 2020 via email

@MikeMM70
Copy link

MikeMM70 commented Nov 4, 2020 via email

@darkoperator
Copy link
Owner

darkoperator commented Nov 12, 2020 via email

@benchisler
Copy link
Author

benchisler commented Jan 11, 2021 via email

@darkoperator
Copy link
Owner

darkoperator commented Jan 11, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants