https://github.com/thordreier/keepassimportexport
PowerShell module: Import-KeePassEntry and Export-KeePassEntry - simple wrapper for PoShKeePass
https://github.com/thordreier/keepassimportexport
kdbx kdbx-database kdbx-files keepass password powershell powershell-module
Last synced: 4 months ago
JSON representation
PowerShell module: Import-KeePassEntry and Export-KeePassEntry - simple wrapper for PoShKeePass
- Host: GitHub
- URL: https://github.com/thordreier/keepassimportexport
- Owner: thordreier
- License: mit
- Created: 2022-04-29T11:36:05.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T12:11:16.000Z (almost 2 years ago)
- Last Synced: 2024-04-05T13:30:48.170Z (almost 2 years ago)
- Topics: kdbx, kdbx-database, kdbx-files, keepass, password, powershell, powershell-module
- Language: PowerShell
- Homepage: https://www.powershellgallery.com/packages/KeePassImportExport/
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KeePassImportExport
PowerShell module: Import-KeePassEntry and Export-KeePassEntry - simple wrapper for PoShKeePass.
## Usage
### Examples
```powershell
############################ KeePass to KeePass sync ###########################
# Connect to first KeePass database
$kdbx1 = Get-Item -Path C:\path\to\keepass\file1.kdbx
$masterKey1 = Get-Credential -Message MasterKey1 -UserName NOT_USED
$db1 = $kdbx1.BaseName
if (-not (Get-KeePassDatabaseConfiguration -DatabaseProfileName $db1))
{
New-KeePassDatabaseConfiguration -DatabaseProfileName $db1 -DatabasePath $kdbx1.FullName -UseMasterKey
}
# Connect to second KeePass database
$kdbx2 = Get-Item -Path C:\path\to\keepass\file2.kdbx
$masterKey2 = Get-Credential -Message MasterKey1 -UserName NOT_USED
$db2 = $kdbx2.BaseName
if (-not (Get-KeePassDatabaseConfiguration -DatabaseProfileName $db2))
{
New-KeePassDatabaseConfiguration -DatabaseProfileName $db2 -DatabasePath $kdbx2.FullName -UseMasterKey
}
# Sync from first to second KeePass file
Export-KeePassEntry -RootPath toplevel/export -DatabaseProfileName $db1 -MasterKey $masterKey1 | Import-KeePassEntry -RootPath toplevel/import -DatabaseProfileName $db2 -MasterKey $masterKey2
################### KeePass to Pleasant Password Server sync ###################
# Install PPS module
Install-Module -Name PPS -Scope CurrentUser
# Connect to KeePass database
$kdbx = Get-Item -Path C:\path\to\keepass\file.kdbx
$masterKey = Get-Credential -Message MasterKey -UserName NOT_USED
$db = $kdbx.BaseName
if (-not (Get-KeePassDatabaseConfiguration -DatabaseProfileName $db))
{
New-KeePassDatabaseConfiguration -DatabaseProfileName $db -DatabasePath $kdbx.FullName -UseMasterKey
}
# Connect to Pleasant Password Server
Connect-Pps -Uri password.company.tld
# Sync from KeePass to Pleasant Password Server
Export-KeePassEntry -RootPath toplevel/export -DatabaseProfileName $db -MasterKey $masterKey | Import-PpsEntry -RootPath 'Root/Private Folders/xxx/import'
################### Pleasant Password Server to KeePass sync ###################
# Install PPS module
Install-Module -Name PPS -Scope CurrentUser
# Connect to KeePass database
$kdbx = Get-Item -Path C:\path\to\keepass\file.kdbx
$masterKey = Get-Credential -Message MasterKey -UserName NOT_USED
$db = $kdbx.BaseName
if (-not (Get-KeePassDatabaseConfiguration -DatabaseProfileName $db))
{
New-KeePassDatabaseConfiguration -DatabaseProfileName $db -DatabasePath $kdbx.FullName -UseMasterKey
}
# Connect to Pleasant Password Server
Connect-Pps -Uri password.company.tld
# Sync from Pleasant Password Server to KeePass
Export-PpsEntry -RootPath 'Root/Private Folders/xxx/import' | Import-KeePassEntry -RootPath toplevel/import -DatabaseProfileName $db -MasterKey $masterKey
```
Examples are also found in [EXAMPLES.ps1](EXAMPLES.ps1).
### Functions
See [FUNCTIONS.md](FUNCTIONS.md) for documentation of functions in this module.
## Install
### Install module from PowerShell Gallery
```powershell
Install-Module KeePassImportExport
```
### Install module from source
```powershell
git clone https://github.com/thordreier/KeePassImportExport.git
cd KeePassImportExport
git pull
.\Build.ps1 -InstallModule
```