Hello All,
I am trying to use the below script to add multi-value registry key
the script is working fine except he is writting only the last value of the variable
any help please
Add-PSSnapin Quest.ActiveRoles.ADManagement
$data= get-QADUser $env:USERNAME -IncludedProperties MemberOf
$1= $data.memberof -split(",OU") -split "CN=" | Select-String -AllMatches "_Teachers"
$2 = $1 -creplace "_Teachers", "*"
Foreach($item in $2){
$item
REG add "HKCU\Volatile Environment" /v Impero_PopulateMyPersonalGroupWithUsers /t REG_MULTI_SZ /s "," /d "[$item]" /f}