Use KEE PASS in Powershell Script to pass Username and Password

1.5k Views Asked by At

Is There a good artical on how to setup KeePass in a powershell script? The goal is to hide UserName and Password in the PS script that is used for sFTP file transfers. I would like to reference the UserName and Password Stored in KeePass to pull into a Powershell script so the sFTP Transfer can happen.

Here is what I have so far:

#Log credential fetch
$ftpcreds = "Look to Keepass "app" and then look to the database within keepass "DataBase1"
-ArgumentList $ftpcreds.UserName, $ftpcreds.Password "this would pull the User Name and Password"

# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "Acme123"
    UserName = $ftpcreds.UserName
    Password = $ftpcreds.Password
    SshHostKeyFingerprint = "ssh-rsa 123456"
0

There are 0 best solutions below