-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXAMPLES.ps1
66 lines (49 loc) · 2.54 KB
/
EXAMPLES.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
############################ 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