Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing domain name in batch on directory

Status
Not open for further replies.

Shelter

Technical User
May 22, 2002
73
0
0
CH
Hi,

Is it possible to batch rename domain/groups for directory restrictions ?

Some users/groups will move from one domain to another one, the group name will stay the same, but not the domain (ex.: Dom1\GroupA will become Dom2\GroupA)

Can I automate this, and keep the same users in GroupA ?

The users will be moved before.

Thank you
 
Here is a simple BAT to do this...
Run it on a computer in the new domain. Use global.exe from the resource kit to create the list of group members (local.exe for local groups). Then use 'net group' to recreate the group with members from the list. There must be a trust between the domains, or you could break it into two steps creating the list on the one domain then moving the file to the second domain and create the group.
Code:
REM Syntax: GrpMov.bat GroupName OriginalDomain
@echo off
d:\ntreskit\global.exe %1 %2 > c:\temp\members.tmp
For /F %%i in (c:\temp\members.tmp) do net group %1 %%i /add /domain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top