
You can simplify testing during Dynamics CRM migrations with this script we wrote long ago that is still helpful today! The script below allows you to grab all existing active CRM users from a database, and create a script to import them into your Domain so you can then link up the users for testing on “CRM db Import”.
Without this script, one would have to manually create users in AD, or ignore ALL users and create new ones for testing accounts.
declare @org nvarchar(100)
SET @org = ‘your org name’
select ‘dsadd ou cn=’ + @org + ‘,dc=yourdomain,dc=com’
union
select distinct
‘dsadd user “cn=’ + right(domainname, len(domainname) – charindex(‘\’, domainname))
+ ‘,cn=Users,DC=’ + @org + ‘,DC=com” -upn ‘ + right(domainname, len(domainname) – charindex(‘\’, domainname)) + ‘@’ + @org + ‘.com’
+ ‘ -fn “‘ + firstname + ‘” ‘
+ ‘ -ln “‘ + lastname + ‘” ‘
+ ‘-e “‘ + u.InternalEMailAddress +'”‘
+ ‘-pwd Password1 -desc “MSCRM Redeploy Account”‘
from SystemUser u
where isnull(domainname, ”) != ” and IsDisabled = 0
Thank you for checking out this technical blog. If you have any questions or are seeking a CRM partner please give us a shout!