I am new to PowerShell scripting
I have scenario I need to set group names in ADServiceAccount, for that I have saved group names in one variable:
$groupnames = "grp1,grp2"
$accountname = "user1"
$controller = "DC=zzabc,DC=zzadc,dc=ap,dc=com"
I have tried with below command but with the below command it is through error
Set -ADSServiceAccount -Identity $accountname -groupnames $groupnames -server $controller
Error:
Identity info provided in the extended attribute : 'groupnames' could not b resolves, reason:'cannot find an object with identity:'grp1,grp2' under 'DC=zzabc,DC=zzadc,dc=ap,dc=com'
... but IF I pass directly group names to command it will work, like below
Set-ADSServiceAccount -Identity $accountname -groupnames grp1,grp2 -server $controller
Kindly help to resolve the issue,, Thanks in Advance!!!