Add currently logged in user Name/profile in the value area of user registry key

I have a great success of using Invoke-HKCURegistrySettingsForAllUsers so far and it always worked like a charm. I have a new use case to add these User Keys where value section also needs currently logged on user name. I’ve tried couple of things but did not get expected result for me. Any way to achieve this?

[scriptblock]$HKCURegistrySettings = {
Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'AAA' -Value "C:\Users\%UserName%/Documents/A1/A2" -Type String -SID $UserProfile.SID
 Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'BBB' -Value "C:\Users\%UserName%/Documents/B1/B2" -Type String -SID $UserProfile.SID
 Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'CCC' -Value "C:\Users\%UserName%/Documents" -Type String -SID $UserProfile.SID
 Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'DDD' -Value "C:\Users\%UserName%/Documents/D1/D2" -Type String -SID $UserProfile.SID
  }
        Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings

%UserName% means ‘%UserName%’ in Powershell

So you have 2 solutions:

1- Have PSADT plug in the value with $EnvUserName

 Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'CCC' -Value "C:\Users\$EnvUserName/Documents" -Type String -SID $UserProfile.SID

2-Have windows plug in the value on the fly with -ExpandString:

 Set-RegistryKey -Key 'HKCU\Software\ABC\XYZ' -Name 'CCC' -Value "C:\Users\%UserName%/Documents" -Type ExpandString -SID $UserProfile.SID