When adding users to CRM via the Add Muliple Users tool, it's possible to view all users in Active Directory and then add them as CRM users
In a hosted environment, this is not ideal as admin users for each organisation will be able to see users from all other hosted customers.
With CRM 4, there was a method of restricting users to only browse users in a particular business unit (see here). Unfortunately, this tool does not work with CRM 2011.
By looking at an old CRM 4 instance, I had a hunt around to see which settings were changed by the config tool to see if they would still work in CRM 2011. Thankfully, I found where to add the settings and it still appears to work in CRM 2011.
Note: The rest of this post involves making changes directly to the MSCRM_CONFIG database and this is completely unsupported. Please only try this if you have your CRM databases backed up.
I've created the script below which enters the OU settings into the MSCRM_CONFIG database, just as the tool for CRM 4 used to.
You'll need the unique name of your organisation (you can get this from settings\customizations\developer resources).
You'll also need the LDAP path of the Active Directory OU which contains the users for the organisation.
Mine was quite basic, so the OU is in the root of my AD forest.
Put the 2 settings into the settings section of the SQL script and then run it against your MSCRM_CONFIG database.
--##ENTER SETTINGS HERE
--##This is the unique name of the organisation
SET @crmOrg = 'YourOrgUniqueName'
--##This is the LDAP path to the Active Directory OU containing the users for the organisation
SET @ou = 'LDAP://dev.dom/OU=TestOU;DC=dev;DC=dom'
--##ENTER SETTINGS HERE
SET @crmId = (SELECT [ID] FROM [MSCRM_CONFIG].[dbo].[Organization] WHERE UniqueName = @crmOrg)
SET @exists = (select [ID] from [MSCRM_CONFIG].[dbo].[OrganizationProperties] where [ID]=@crmId and [ColumnName] = 'UserRootPath')
IF(@exists is null)
BEGIN
INSERT INTO [MSCRM_CONFIG].[dbo].[OrganizationProperties]
([id], [columnname], [nvarcharcolumn], [encrypted])
VALUES (@crmId, N'UserRootPath', @ou, 0)
END
ELSE
PRINT 'Setting already exists for organisation'
Once the script has executed you will need to reset IIS on your CRM server via iisreset /restart at the command line.
Now when you try to add users again via the Add Multiple Users wizard, you will only be able to see users belonging to the OU specified
Remember, you are doing this at your own risk!