Skip to main content

Using ShareGate's PowerShell module with other modules

Limitations while running scripts with other modules such as PnP PowerShell

ShareGate Migrate has a PowerShell module with a set of cmdlets, functions, parameters, etc.

Note: PowerShell integration requires a ShareGate Migrate Pro or Enterprise subscription. It is not available on the Essentials plan.

Details

Using external PowerShell modules alongside the ShareGate Migrate module may cause unexpected behaviors.

While we do our best to help with these cases, ShareGate Migrate does not officially support external PowerShell modules.

It's always best to use the ShareGate Migrate PowerShell module exclusively for your operations.

To check whether another module causes an error, open PowerShell from ShareGate Migrate using the button in the bottom-left corner. That window loads only the ShareGate module. If the error still happens there, see Another version of a DLL in your Global Assembly Cache (GAC) is prioritized.

PnP PowerShell

Though you can expand ShareGate's capabilities with PnP PowerShell's module, running both modules in the same PowerShell session can cause problems.

To use PnP cmdlets, we recommend the stepped approach described below:

  1. Import the PnP PowerShell module.

  2. Execute your pre-migration PnP scripts. For example, provisioning site collections.

  3. Close the PowerShell session.

  4. Open a new PowerShell session where PnP PowerShell has not been imported, then import the ShareGate PowerShell module.

  5. Execute your ShareGate migration scripts.

  6. Close the PowerShell session.

  7. Open a new PowerShell session and import the PnP PowerShell module.

  8. Run your post-migration PnP scripts.

Note: Disconnecting or removing the PnP PowerShell module is not enough, because its libraries stay loaded until the session closes. If PnP PowerShell and ShareGate Migrate run in the same session, you may see an import that stays stuck at Microsoft 365 importing items in Insane mode, or Method not found and Could not load type errors.

Did this answer your question?