You can use the On Demand Migration (ODM) PowerShell module to interact with objects in your On Demand Migration environment using PowerShell cmdlets. The cmdlets allow you to perform tasks, such as account discovery, mail migration, OneDrive migration, task and event management in a PowerShell scripting environment.

Deploying the ODM PowerShell Module

The ODM PowerShell module must be requested from Quest and are not included with the ODM Subscription. Loading the ODM module is the same as loading any other third-party PowerShell module. The module must be loaded for each PowerShell session.

To enable the ODM PowerShell API:

  1. Get the ODMApi.zip file from Quest Technical Support.
  2. Unblock the file: Right-click the file > Properties > Unblock > OK.
  3. Unzip the ODMApi to a folder on the local machine.
  4. Start PowerShell (Run as administrator)
  5. Set Powershell Execution Policy to unrestricted with the command set-executionpolicy unrestricted
  6. Install the ODMApi Module. For example, if your unzipped file is in the C:\OdmAPI folder, then use the command: Import-Module C:\OdmAPI\OdmAPI -Global

Connecting to the ODM service

Before you can use the ODM PowerShell cmdlets to interact with your ODM environment, you must connect and authenticate your access to your ODM host. The credentials you use must be granted a role with sufficient privileges to work with the On Demand Migration services.

On Demand User Role Requirements

User must have the Migration Administrator role to access and run any of the On Demand Migration PowerShell commands. On Demand ships with this role. See the On Demand Global Settings Current User Guide for more information about setting up roles.

Authentication

The Microsoft Account Authentication Workflow requires user interaction for the initial authentication with Microsoft. When Microsoft Account authentication is used all authentication is handled via Microsoft and the user’s Azure Active Directory. This type of authentication supports MFA and is fully controlled by the user’s Azure Active Directory Conditional Access Policies. Any password and lockout policies are also managed directly by the customer through their Azure Active Directory.

To connect to the ODM service
  1. Run the following command to connect to your ODM Service. The default region is US.
    Connect-OdmService

    To connect to a specific region like Europe, run the command Connect-OdmService -Region EU. The region value can be set in the OdmApi.psm1 file by editing this line: [string]$Region = 'us'. For example to set default region to Europe replace the line to [string]$Region = 'EU'.

  2. This command will redirect the user to the Microsoft Authentication workflow to authentication against the user’s Azure Active Directory. In the authentication dialog, enter the credentials of the On Demand account (not the tenant account)

    If MFA is enforced, users will see an additional window

Selecting the organization and migration project

Step 1: Get the organization id
  1. Log in to Quest On Demand
  2. From the Choose an organization page, note the organization id

- or, if you have already selected an organization -

  1. Click the logged in user name from the top right corner of the page
  2. Click the Organization Name from the drop-down to open the Edit Organization page. Then make a note of the organization id
Step 2: Connect to the organization

In your PowerShell session console, enter the command

Select-OdmOrganization -OrganizationId '6a079d6e-e37a-475b-acba-8b08e9caa430'
Step 3: Select a migration project

Once connected to the Organisation, we need to connect to the Project, the project GUID is required, this is obtained from the ODM GUI or running the command Get-ODMProject which will list all past and present projects associated with the ODM organization, an example of this command is below:

Get-OdmProject | fl
Name                          : Source Corp ➜ Target Corp
Description                   : Excepteur sint occaecat
SourceTenantDefaultDomainName : sourcecorp.onmicrosoft.com
TargetTenantDefaultDomainName : targetcorp.onmicrosoft.com
Id                           : Elf813YBfQYAK6Q42Kun
Step 4: Connect to your project

Identify the project Id and connect to the project using the following command.

Select-OdmProject 'Elf813YBfQYAK6Q42Kun'