Metalogix Content Matrix Console - SharePoint Edition has the ability to generate PowerShell scripts, which can then be used to migrate your SharePoint content through the PowerShell command window. SharePoint Edition can use a job list or batch file to create a PowerShell script, and this script can then be run from the PowerShell console. This means that anything users can do through the SharePoint Edition's User Interface (UI) can also be done though PowerShell, adding all of PowerShell's capabilities to a migration.
When the SharePoint Edition is installed a Metalogix Content Matrix Console - SharePoint Edition PowerShell Console is installed under the same Start menu folder location. When this PowerShell console is used it will already have the three Metalogix PowerShell plug-ins installed as well as the three snap-ins installed. It can be accessed from the Start menu at: Metalogix > Content Matrix Console > SharePoint Edition > Content Matrix Console - SharePoint Edition PowerShell Console (as seen below).
In the main UI, go down to the Job List section and select a job (or jobs) that you want to run in PowerShell.
Click the Generate PowerShell Script button in the Job List's tool bar, or right-click on one of the items and select Generate PowerShell Script from the context menu. This will open a drop down menu that allows users to select between two user based PowerShell script generation options. These option are:
For Current User and Machine - This option will generate a PowerShell script based on the currently logged in User Account. Any PowerShell scripts that are generated through this option can only be run by the logged in user (on the machine they were generated on). This is the most likely scenario.
For Local Machine - This option will generate a PowerShell script that can be used by any User account on the machine they are created on.
For Certificate - This option will generate a PowerShell script that can be used by any User account on any machine that has the certificate that is specified when the script is created. When users try to save the PowerShell script using this method they will be prompted to select a security certificate that exist on that machine. The selected certificate will be required on any system that attempts to run the script at a later date.
Once the PS script generation type is selected, Content Matrix Console will generate a PS script for the select Job, which will be written out to a Microsoft Notepad file. If multiple jobs are selected they will all be written out, into the same file.
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. To do this click 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.
In the PowerShell (PS) script itself you may notice five sections (see the image below). 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 snappins 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 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.
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.
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 it's 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.
In the case that 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.
The migration will begin, and any warnings and/or errors that are encountered in running the script will be displayed in the PowerShell window.
For more information on Content Matrix Console - SharePoint Edition's PowerShell cmdlets please see the SharePoint Edition PowerShell Command-Let List page for details.
© Copyright Metalogix International GmbH, 2001- 2017