Copy Group Membership from one computer to another

This is a more complex script and harder to explain, but let's try..

First the script creates a new object to hold a Task Sequence variable.

Then it checks if it really got the name and if it did not, it trys to look in the D:\XPcomputername.txt

You can make this file, creating a run command in your TS. The command is cmd /c %_SMSTSMachineName% > D:\XPcomputername (you can put here whatever and wherever you want)

Cool. Then if it still doesn't have the name, then it quits.

Otherwise it gets the new computer name. Copy all the groups from the old computer to the new computer.

Then it checks if both computers have the same groups before deleting the old computer from AD.

Oh yes and  this

{

 

$_.DN -notmatch "CN=Domain"}

means that it should not copy this group. The reason is that it's the primary gorup for all the computers here and it can't be overwriten. So to avoid problems it is excluded.

You can adapt this script to satisfy your needs. And you don't need to run it from the TS. You will have to make some changes though.

Anonymous