I have got Strings in an array which are the names of groups. Now I would like to modify those values and connect an other String to the beginning of this String
$Groups = Get-ADPrincipalGroupMembership $User $GroupArray = @()
foreach ($Group in $Groups)
{
$GroupArray += ($Group | select name)
}
echo $("Domain\" + $GroupArray[0])
This prints something like:
Domain\@{name=Domain Users}
However I would like to get something like:
Domain\Domain Users
"Domain\$(GroupArray[0].Name)"Select-Object Nameyou have an object with a property namedName. it seems that you want to have JUST the value from the prop. if that is the case, then change that toSelect-Object -ExpandProperty Nameto get just the value.