Hi,

I have quite a few nested security and distribution groups that I want to add 
to another group (for GPP purposes). I can do this with:

Get-ADGroupMember "Top Level Group" -Recursive | ForEach-Object { 
add-adgroupmember -identity "GPP group" -members $_}

However the membership changes within the original groups a bit, so I was going 
to script this with this above it:

Remove-ADGroupMember "GPP Group" -Members (get-adgroupmember "GPP Group") 
-Confirm:$false

So this clears the group down and then re-adds the right users each time in the 
case that the group changes and a user is added or removed.

However, this doesn't seem in my mind to be the best way to do it. What id like 
to do is an add and then a remove if the user no longer exists, rather than 
clear the whole group each time, is there a syntax for this that will work? I 
guess Im looking for an " IS NOT" statement or something?

Gavin Wilby

SMP Partners Limited, SMP Trustees Limited and SMP Fund Services Limited are 
licensed by the Isle of Man Financial Services Authority. SMP Accounting & Tax 
Limited is a member of the ICAEW Practice Assurance Scheme.

SMP Partners Limited registered in the Isle of Man, Company Registration No: 
000908V
Directors: M.W. Denton, M.J. Derbyshire, S.E McGowan, O. Peck, J.J. Scott, S.J. 
Turner

SMP Trustees Limited registered in the Isle of Man, Company Registration No: 
068396C
Directors: A.C. Baggesen, J.M. Cubbon, M.W. Denton, K.M. Goldie, O Peck, J. 
Watterson

SMP Fund Services Limited registered in the Isle of Man, Company Registration 
No: 120288C
Directors: V. Campbell, R.K. Corkhill, M.W. Denton, D.A. Manser, S.E McGowan, 
J.J. Scott 

SMP Accounting & Tax Limited registered in the Isle of Man, Company 
Registration No: 001316V
Directors: I.F. Begley, A.J. Dowling, P. Duchars, J.J. Scott, S.J. Turner

SMP Capital Markets Limited registered in the Isle of Man, Company Registration 
No: 002438V
Directors: M.W. Denton, M.J. Derbyshire, D.F Hudson, S.E McGowan, O. Peck.

SMP Partners Limited, SMP Trustees Limited, SMP Fund Services Limited, SMP 
Accounting & Tax Limited and SMP Capital Markets Limited are members of the SMP 
Partners Group of Companies.

This email is confidential and is subject to disclaimers. Details can be found 
at: http://www.smppartners.com/disclaimer.asp

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

Reply via email to