mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
For Windows try to migrate all user settings, not only the ones of local users
This commit is contained in:
16
dist/win/contrib/version170-migrate-settings.ps1
vendored
16
dist/win/contrib/version170-migrate-settings.ps1
vendored
@@ -7,19 +7,9 @@
|
||||
|
||||
#Get all active, local user profiles
|
||||
$profileList = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList'
|
||||
$localUsers = Get-LocalUser | Where-Object {$_.Enabled} | ForEach-Object { $_.Name}
|
||||
|
||||
Get-ChildItem $profileList | ForEach-Object { $_.GetValue("ProfileImagePath") } | Where-Object {
|
||||
$profileNameMatches = ($_ | Select-String -Pattern "\\([^\\]+)$").Matches
|
||||
if($profileNameMatches.Count -eq 1) {
|
||||
#check if the last path part is contained in the local user name list
|
||||
#otherwise do not touch it
|
||||
return $localUsers.Contains($profileNameMatches[0].Groups[1].Value)
|
||||
} else {
|
||||
return $false;
|
||||
}
|
||||
} | ForEach-Object {
|
||||
$settingsPath = "$_\AppData\Roaming\Cryptomator\settings.json"
|
||||
Get-ChildItem $profileList | ForEach-Object {
|
||||
$profilePath = $_.GetValue("ProfileImagePath")
|
||||
$settingsPath = "$profilePath\AppData\Roaming\Cryptomator\settings.json"
|
||||
if(!(Test-Path -Path $settingsPath -PathType Leaf)) {
|
||||
#No settings file, nothing to do.
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user