2026-07-19 22:06:07 +02:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Converts a registry-backup target identifier into a user-friendly label.
|
|
|
|
|
#>
|
|
|
|
|
function Get-FriendlyRegistryBackupTarget {
|
2026-05-08 21:19:52 +02:00
|
|
|
param(
|
|
|
|
|
[AllowNull()]
|
|
|
|
|
[AllowEmptyString()]
|
|
|
|
|
[string]$Target
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if ([string]::IsNullOrWhiteSpace($Target)) {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetUnknown'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Target -eq 'DefaultUserProfile') {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetDefaultUserProfile'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Target -eq 'CurrentUser') {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetCurrentUser'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Target -eq 'AllUsers') {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetAllUsers'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Target -like 'CurrentUser:*') {
|
|
|
|
|
$userName = $Target.Substring(12)
|
|
|
|
|
if ([string]::IsNullOrWhiteSpace($userName)) {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetCurrentUser'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetCurrentUserNamed' -FormatArgs @($userName)
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Target -like 'User:*') {
|
|
|
|
|
$userName = $Target.Substring(5)
|
|
|
|
|
if ([string]::IsNullOrWhiteSpace($userName)) {
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetUser'
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
2026-09-10 21:18:43 +05:30
|
|
|
return Get-Translation -Key 'RestoreTargetUserNamed' -FormatArgs @($userName)
|
2026-05-08 21:19:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $Target
|
2026-07-19 22:06:07 +02:00
|
|
|
}
|