04 Oct 2017

Moving a company to a new reseller

There may come a time where you need to move a customer to a new reseller for a various reasons, but CloudPanel doesn’t provide an option to move the company for you. We decided against writing this in CloudPanel due to the amount of problems that could arise if everything wasn’t moved properly, which is why we prefer doing manually.

WARNING: Not following these instructions right could result in CloudPanel issues. If you do not feel comfortable with performing these steps, then please contact us. Make sure that you backup your CloudPanel database BEFORE starting. We HIGHLY recommend that you create a test company and practice moving that company to a new reseller before an actual production company.

Backup Information

Backup, backup, backup!
Since we will be making modifications in SQL manually, please be sure to backup the sql database and choose the option to verify the backup. We are not responsible for any lost data, so PLEASE be sure to backup your database!

Gather Information

planning is key
It is important to gather all of the information ahead of time. During this example we will be using SQL Management Studio to interact with SQL server.
  • Determine the company code of the company we are moving
    • On the companies view in CloudPanel you will see a list of companies which will include a column named “Code”. This is the company code you need.
  • Find out what the reseller code of that company is
    • On the resellers view you will see a list of resellers which include a column named “Code”. This is the reseller code you need.
  • Determine the new reseller code that we will be moving the company to
    • On the same resellers view you can find the new reseller’s code

Move the Organizational Unit

in Active Directory
The first thing we will need to do is move the company’s organizational unit. In this example going forward we will be moving a company with the code ‘COM‘ that is under the reseller with code ‘LAB‘ to a new reseller that has a code of ‘TEN‘. These are just examples and does not match your environment. You need to replace the appropriate codes with the ones you are moving in YOUR environment.
  • Find the company with code “COM” in Active Directory, right click the organizational unit, and choose “Move”
  • In this example we are moving this company to the reseller with code “TEN”. Once you find “TEN” select it and choose OK.
  • Now that the organizational unit has been moved, go find it and open “AllTSUsers@COM”. Select the Member Of tab and remove the old GPOAccess@LAB group from this list. Now click on Add and find GPOAccess@TEN. (RememberĀ  the group names will be different because your codes for the reseller and the company are different)

Update the Database

almost done!
Now that you have moved the organizational unit in Active Directory, CloudPanel will no longer be able to manage this company for you. So we now need to go into SQL Server Management Studio and update the sql tables. To do this, please open SQL Server Management Studio, click on New Query, and make sure you select your CloudPanel database from the dropdown:

Step 1:

First thing we need to do is update the company to be under the new reseller. Change theĀ  ResellerCode value to your NEW reseller and the CompanyCode value to your company in the script below before executing:

Step 2:

Now that we have changed the reseller association for that company in the database, you should see it listed under the proper reseller in CloudPanel. However, there are still other objects we need to migrate. Next, we need to update the user’s distinguished name:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Step 3:

Next is to update security groups if you have any:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Step 4:

Next is to update any Exchange mail contacts you may have:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Step 5:

Next is to update any Exchange distribution groups you may have:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Step 6:

If you have any public folder mailboxes then those will have to be updated as well:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Step 7:

Update any resource mailboxes that you may have:

Notice in the command above that OU=LAB contains the old reseller code “LAB” and we are replacing it with the new reseller code “TEN”.

Conclusion

Did everything work?
Once everything is moved, please login to CloudPanel and make sure you can access all of the objects. If you had any custom scripts or third party options that may have bound to a specific distinguished name, then those will not be working because we essentially changed the distinguished name in Active Directory by moving the organizational unit to a new path. There are some other possible third party integrations that we know about that will break because of this:
  • Mailprotector LDAP directory sync will break when moving an organizational unit because the distinguished name has changed. To fix this, simply login to Mailprotector’s console and update the distinguished name for that company under the Directory Sync tab.
  • Sometimes login scripts are written to check a specific organizational unit that a user belongs to. These may break if the script was comparing an entire distinguished name because the distinguished name has changed.