Metalogix Content Matrix can run PowerShell commands after some initial PowerShell configuration. The following steps need to be performed one time only.
To run PowerShell commands with Metalogix Content Matrix:
1.Change the working directory of PowerShell to the installation directory of that Metalogix Content Matrix edition.
2.Register the Metalogix.SharePoint.Commands DLL.
3.Register the Metalogix.System.Commands DLL.
4.Register the Metalogix.ERoom.Commands DLL.
5.Register the Metalogix.Jobs.Reporting.Commands DLL.
6.Add the PowerShell snap-ins for the Metalogix Application Framework. This step must be done each time you open and use PowerShell with Metalogix Content Matrix.
1.Open a PowerShell command window.
NOTE: While 64-bit systems normally open 64-bit versions of PowerShell, they can also run 32-bit PowerShell by going to Start > All Programs > Accessories > Windows PowerShell and selecting Windows PowerShell (x86).
2.In the PowerShell command window, change the working directory to the installation folder for Metalogix Content Matrix. If the default installation location is used for installing Metalogix Content Matrix, then this command should be:
·For 64-bit systems: CD "C:\Program Files (x86)\Metalogix\Metalogix Content Matrix Consoles\eRoom Edition"
·For 32-bit systems: CD "C:\Program Files (x86)\Metalogix\Metalogix Content Matrix Consoles\eRoom Edition"
3.After the directory has been changed to the installation folder in the PowerShell command window, enter:
·For 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe Metalogix.SharePoint.Commands.dll
·For 32-bit systems: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe Metalogix.SharePoint.Commands.dll
4.Wait for the command to run. You should see "The transacted install has completed" when the install has been completed. Enter the command:
·For 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe Metalogix.System.Commands.dll
·For 32-bit systems: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe Metalogix.System.Commands.dll
5.Wait for the command to run. You should see "The transacted install has completed" when the install has been completed. Then, enter the command:
·For 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe Metalogix.ERoom.Commands.dll
·For 32-bit systems: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe Metalogix.ERoom.Commands.dll
6.Wait for the command to run. You should see "The transacted install has completed" when the install has been completed. Enter the command:
·For 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe Metalogix.Jobs.Reporting.Commands.dll
·For 32-bit systems: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe Metalogix.Jobs.Reporting.Commands.dll
Wait for the command to run. All four DLL files have now been registered in PowerShell. Continue the installation process by adding the Metalogix Application Framework snap-ins. Registering each of the DLL files only needs to be done once in PowerShell.
After the Metalogix DLLs are registered in PowerShell, you can add the snap-ins. These three snap-ins must be run each time PowerShell is open. It is possible to set up your PowerShell profile so that it automatically adds these snap-ins each time you open PowerShell.
To add PowerShell snap-ins:
1.Make sure that PowerShell is opened and set to the Metalogix Content Matrix application directory
2.Enter the following command to load the first snap-in: Add-PSSnapin Metalogix.SharePoint.Commands.
3.To add the second snap-in enter the command: Add-PSSnapin Metalogix.System.Commands.
4.To add the third snap-in enter the command: Add-PSSnapin Metalogix.eRoom.Commands.
1.Once the Metalogix snap-ins are added they should appear in the list of PowerShell snap-ins. You can view the list of snap-ins by entering Get-PSSnapin. The Metalogix snap-ins should be listed under Metalogix.SharePoint.Commands and Metalogix.System.Commands.
PowerShell is now configured to run with Metalogix Content Matrix.
NOTE: When Metalogix Content Matrix is installed it will automatically try to install all of the DLL files, and will also add a PowerShell console. If this PowerShell console is used all of the snap-ins will automatically be added, and ready for use.
A Notepad file will open containing the PowerShell script for any selected job(s). This file can now be saved as a PowerShell script file.
5.Choose File > Save As... and select any desired save location for the PowerShell script. Give the file any name you want, but change the file type to .PS1.
The PowerShell (PS) script itself contains five sections. They are:
§Section 1 - This first section at the top (starting with an "if" statement) runs a check in the PowerShell console to make sure that the Metalogix snap-pins have been added. If they are not found then it will add them to that instance of the PS console.
§Load Configuration settings - This section will find and load all of the Metalogix Content Matrix client application configuration settings into the PowerShell script. These are the client application's environmental settings and not the migration/action settings.
§Load source - This section will load all of the data for the source environment connection.
§Load target - Similar to the previous section, this will load target environment's connection information.
§Run the action - Last is the "Run the action" section. This last section will contain all of the other data for the migration, such as the type of migration (i.e. a site migration, list migration, item migration, etc.) and all of the settings and configurations for the migration/action that is being run. This includes things like settings for versions, content types, permissions, etc.
To run the PowerShell script:
1.On your desktop open the Metalogix Content Matrix Console - SharePoint Edition PowerShell Console shortcut, for the PowerShell window with the Metalogix plug-ins and snap-ins already installed.
2.In the PowerShell window you can set yourself to act from any desired directory. In some cases users will set themselves to the same directory that contains their PowerShell scripts. Now enter the name and extension of the PowerShell Script (at its specified location), and the script will run.
In the case that you are running a script from the same directory you would use the format: .\[ScriptName].ps1. So if your PowerShell scrip was named "ResourceScript.ps1" then you would enter: .\ResourceScript.ps1 into the window, and the script would run.
If the script is in a different directory, you would enter the location of that directory relative to your current location, followed by the script name. For example, if your prompt is at the "C:\" drive and your PowerShell script, named "ResourceScript.ps1" is on the desktop you would enter: C:\Users\[User]\Desktop\ResourceScript.ps1, and the script would run.
NOTE: In some cases the Execution Policy may prevent you from executing a PowerShell script. In this case you will likely see the message: [Script].ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details. In this case, running the command: set-executionpolicy RemoteSigned should change the existing script policy to allow you to run these scripts for your location. It is advised that you check with your System Administrators before doing this to ensure that no Company Policies are being broken by this action. If this is an action you need to take, you should only need to run this command once.
The migration will begin, and any warnings and/or errors that are encountered in running the script will be displayed in the PowerShell window.
Metalogix Content Matrix can generate PowerShell script for you, for any migration action that is available through it. The below cmdlets are used in the generated PowerShell script, but can also be used to write your own script, should you desire to do so. For more information on each cmdlet, simply type get-help [cmdlet]. For example, if you want more information on Copy-MLSharePointList cmdlet you would enter get-help Copy-MLSharePointList, followed by the Enter (return) key.
Below is a list of the available cmdlets (and their parameters), broken up into the available commands for each snap-in.