AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.01.2012, 14:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
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: 
  • On line 7 you need to specify an OU in your AD where you want your users created.   My domain is gtdomain.com and I created an OU there called GTusers.  Adjust these parameters as required.
  • On lines 11 and 14 I am striping out the domain name ‘SITCRM’ using a replace function.  Adjust this to the domain name of your source system.
Run the script in SQL Management Studio and confirm you get a header row followed by a row per CRM user that looks something like this:



Here’s a quick explanation of the columns:
  • objectclass: this should say ‘user’ – this our way of requesting to have users created in AD
  • DN: this specifies where in the AD our records should be created
  • displayName: this should be the full name of the user
  • givenName: first name of the user
  • sn: surname of the user
  • samAccountNAme: logon for the user
Ok, now we need this result set pushed out to a CSV file.  I do this by going into the Query Options



… 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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 4 Blog bot Dynamics CRM: Blogs 0 24.09.2011 01:16
Gareth Tucker: Quick Create Contact from the CRM Case Form Blog bot Dynamics CRM: Blogs 0 05.09.2011 18:11
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 2011 ~ Online Test Drive Guide Blog bot Dynamics CRM: Blogs 0 05.08.2011 20:13
CRM DE LA CREME! Configuring Microsoft Dynamics CRM 4.0 for Internet-facing deployment Blog bot Dynamics CRM: Blogs 0 18.08.2009 11:05
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:37.