For Windows try to migrate all user settings, not only the ones of local users

This commit is contained in:
Armin Schrenk
2023-02-22 15:33:37 +01:00
parent fe3f2b5bd3
commit a1379bac40

View File

@@ -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;