![]() |
#1 |
Участник
|
Gareth Tucker: How to Bulk Create AD Users during a CRM Redeployment
Источник: http://gtcrm.wordpress.com/2012/01/1...-redeployment/
============== When setting up a CRM test environment in a separate domain from where the production environment exists I find it preferable to replicate the production AD users in that test domain so that you can auto-map each CRM user. Here’s an approach you can follow to bulk create each CRM user in your test environment’s Active Directory… Firstly, we need to get a list of the CRM users, and we need that list formatted a certain way. Here’s an SQL script you can use: SELECT 'objectClass','DN','displayName','givenName','sn','samAccountName'UNION ALLSELECT 'objectClass' = 'user', 'DN' = '"cn=' + [FullName] + ',OU=GTUsers,DC=GTDOMAIN,DC=COM"', 'displayName' = [FullName], 'givenName' = [FirstName], 'sn' = [LastName], 'samAccountName' = replace([DomainName],'SITCRM\','') FROM [SITCRM_MSCRM].[dbo].[SystemUserBase]where [FirstName] ''and replace([DomainName],'SITCRM\','') 'administrator' You will need to localise this script to your environments:
![]() Here’s a quick explanation of the columns:
![]() … and setting the Output format to Comma delimited and unchecking the option to include column headers in the result set: ![]() Then I switch the Results To setting to File: ![]() Finally, I execute the script again. Because I asked the results to go to file I am prompted to specify a file location, so I save the file to my desktop under the name “users.csv”. Run that: ![]() Once generated we need to just a quick correction to the file. If it got created with a .rpt extension go ahead and remove that, we want the file to have a .csv extension. Then open the file in Notepad scroll to the bottom and delete the last couple of lines containing the record count at the end: ![]() Ok, now to import this file into the AD. Make sure you are logged in as a user that can administer the AD. I’m not sure where you can run this from, I ran mine from the Domain Controller. I copied my file to the C drive and then ran the following script: csvde –i –f c:\users.csv If you have success you will see a message like this: ![]() And over in the AD you will have your users: ![]() Hope this helps someone ![]() ![]() Источник: http://gtcrm.wordpress.com/2012/01/1...-redeployment/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|