Migrate user information and passwords in ad to the new environment in batches (Import and Export), and maintain the permissions [addusers, ldifde, copypwd, userinfo, tp_systemid] In the moss]

Source: Internet
Author: User

Tool introduction:

1. ldifde is a built-in command line tool that can be run directly in cmd.

2. addusers is a command tool in wind2k resource kit, which can be obtained by installing wind2k Resource Kit: http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe

3. copypwd can be used to export and import domain user passwords. It can be used to restore the user password after the user is migrated. Of course, since the exported password is a hash result, it can be decrypted, for security, delete the exported password file after use. : Http://blogimg.chinaunix.net/blog/upfile2/081231194831.zip

SQL used:

SQL from: http://vspug.com/dustin/2007/04/08/stsadm-in-a-gui-2007-version/

 

Synchronize the moss user Sid, which is consistent with the ad user Sid.
Declare @ login varchar (40), @ systemid varbinary (128)

Declare curusers cursor local
Select tp_login, tp_systemid from userinfo where tp_deleted = 0

Open curusers

Fetch next from curusers into @ login, @ systemid

While @ fetch_status = 0
Begin
Print 'resetting user' + @ login + 'to new Sid'
Print suser_sid (@ login)
Update userinfo
Set tp_systemid = suser_sid (tp_login) where current of curusers
Fetch next from curusers into @ login, @ systemid
End

Close curusers
Deallocate curusers

Go

In addition:

The tool ADSI editor is also a very useful tool. It can edit a lot of information in AD and help us better understand ad. You can install suptools. MSI in the i386 \ support \ tools directory of the system installation disk. You can also download: Release.

Requirement Description:

If your ad environment is changed multiple times, such as adjusting domain names, modifying settings, and installing domain-related software repeatedly, you will be prompted when installing some software, if you cannot find the domain controller or other errors, you may have to reinstall the system and domain. What should you do? Even if the user has been rescued, most users have changed their passwords. If they want to change the password, and they will not complain to your boss about "how can I reset my password? What are you doing on it every day?" And then these complaints will eventually fall into your head, what should I do at this time? The password is returned, but what about the user's Sid? What can I do with the permissions of a user on a moss website? Although the newly added user is consistent with the previous user information, the SID is inconsistent. As a result, the user's permissions on the moss website need to be reconfigured, if you cannot edit the SID of a new user (at least you do not know how to edit the SID value of the domain user), how can you modify the SID value mapped to the user in the moss website?

 

Steps:

1. Export the specified organizational unit information. 192.168.0.1 is the IP address of the domain controller.

Ldifde-f c: \ exportou. LDF-s 192.168.0.1-d "DC = Moss, Dc = com"-P subtree-R "(& (objectclass = organizationalunit) (ou = testou)"-l "CN, name, objectclass, ou, distinguishedname, objectcategory"

2. Export the user information in the specified domain (organizational unit). 192.168.0.1 is the IP address of the domain controller.

Ldifde-f c: \ exportuser. LDF-s 192.168.0.1-d "ou = testou, Dc = Moss, Dc = com"-P subtree-R "(| (objectclass = user) (objectclass = Group )) "-l" CN, name, objectclass, displayname, distinguishedname, samaccountname, Sn, title, userprincipalname"

3. Import the domain organization unit information. 192.168.0.1 is the IP address of the domain controller.

Ldifde-I-f c: \ exportou. LDF-s 192.168.0.1

4. Import user information in the domain. 192.168.0.1 is the IP address of the domain controller.
Ldifde-I-f c: \ exportuser. LDF-s 192.168.0.1

Token]

Copypwd dump> copypwd.txt

6. guide the user's password in the domain to automatically find the copypwd.txt file in the same directory

Copypwd set

7. enable account [the account is disabled after the user is imported]

8. Change the password policy of your account to [password will never expire]

9. Use the account SID of the ad to synchronize the value of the tp_systemid column in The userinfo column of the moss content database, use the SQL statement described in the Start tool [synchronize the user SID of moss with the user SID of AD ], because the userinfo table in the content database of the moss website stores the user information of the logon website, the tp_systemid column stores the SID value of the AD domain user, therefore, after creating a user, we can use this SQL statement to update the tp_systemid column in The userinfo table so that it is consistent with the SID of the newly added user, in this way, the newly added user's permissions on the moss website do not need to be reconfigured.

Note:
1. After the password is imported, the password policy will change to [Change Password Upon next Login], as long as it is set to [password will never expire] before login]
2. Before the password is imported, delete the account information that does not need to be imported. Import the account information that needs to be restored, and delete the system account information such as administrator.
3. Users who use addusers to import and export domains are limited because the exported user information attributes are limited and some attributes cannot be exported.
4. When using ldifde to import organizational unit and users, some attributes cannot be imported. When I first export the organizational unit, I want to export more attributes and import these attributes, the user information is complete, but some attributes can be exported later, but an error message such as incorrect architecture will be prompted during the import. After many attempts, you can delete attributes that cannot be imported and run properly.

 

 

The following is another old man's blog. The original Article address is as follows. You can also refer to it.

Http://imdbt.blog.51cto.com/903896/213331

[Symptom] a customer's moss server is migrated to a new domain with different domain names. The original user account has also been migrated. Users can log on to the domain, but the moss access prompt does not have the permission, and can also be accessed after re-authorization. [Analysis] After the ad account is migrated to the new domain, the SID changes. The userinfo table in the wss_content database of the moss website stores the old Sid, so the system prompts that the user cannot access the table. Some accounts are manually added to the moss. The SID cannot be updated for these accounts because the userinfo table has a primary key consisting of tp_siteid, tp_login, and tp_deleted. Duplicate operations are not performed. [Solution] 1. update the account and Sid in the userinfo table in the wss_content database to the account and Sid of the new domain. use the cursor technology to obtain an account at a time. use the suser_sid ('loginname') function to obtain the account's Sid 4. replace (column name, 'string', 'string') is used to replace the old domain name with the new domain name 5. begin try .... end try, begin catch... the end catch statement is used to handle exceptions. After the code encounters an exception, you can continue to run the [Fix Code] declare @ login varchar (40), @ systemid varbinary (128)
Declare curusers cursor local
Select tp_login, tp_systemid from userinfo where tp_deleted = 0

Open curusers
Fetch next from curusers into @ login, @ systemid
While @ fetch_status = 0
Begin
Begin try
Print 'resetting login' + @ login + 'to new login'
Update userinfo set tp_login = Replace (tp_login, 'old Domain Name \ ', 'new Domain Name \')
Where current of curusers
End try
Begin catch
Print 'resetting login' + @ login + 'failed! '
Print error_message ()
End catch
Begin try
Print 'resetting Sid '+ @ login +' to new Sid'
Print suser_sid (@ login)
Update userinfo set tp_systemid = suser_sid (tp_login)
Where current of curusers
End try
Begin catch
Print 'resetting Sid' + @ login + 'failed! '
Print error_message ()
End catch
Fetch next from curusers into @ login, @ systemid
End
Close curusers

Deallocate curusers

 

 

Source: http://www.cnblogs.com/virusswb/archive/2009/10/30/1593336.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.