Author Posts

August 30, 2018 at 12:21 pm

Hi all,

I get following error when using a variable, when using the name (TestComAccount2)  it works

code:

get-adgroup -server enc-cap-eds-03.ee.intern "CN=xx-GG-CitrixCloud-Computers-VDI,OU=Citrix,OU=Server Applications,OU=Administration,OU=xxx,DC=xx,DC=xx" | remove-adgroupmember -Members "CN=$Disabeldaccounts,OU=testou,OU=CC-Citrix Cloud Connector,OU=Citrix Services,OU=Infrastructure Services,OU=Servers,OU=xxxx,DC=xx,DC=xxx"

Error message:

remove-adgroupmember : Cannot find an object with identity: 'CN=@{Name=TestComAccount2}.name,OU=testou,OU=CC-Citrix Cloud Connector,OU=Citrix Services,OU=Infrastructure

Services,OU=Servers,OU=xxx,DC=xx,DC=xxx' under: 'DC=xxx,DC=xxx'.

 

do i need to specify the variable different???

 

thnx paul

 

August 30, 2018 at 12:40 pm

Please use the code posting tags when you post code.
I assume you need to resolve the subexpression to use it this way.

get-adgroup -server enc-cap-eds-03.ee.intern "CN=xx-GG-CitrixCloud-Computers-VDI,OU=Citrix,OU=Server Applications,OU=Administration,OU=xxx,DC=xx,DC=xx" | 
    remove-adgroupmember -Members "CN=$($Disabeldaccounts.Name),OU=testou,OU=CC-Citrix Cloud Connector,OU=Citrix Services,OU=Infrastructure Services,OU=Servers,OU=xxxx,DC=xx,DC=xxx"