Since the publication of this article, Sharegate has updated and unified the migration interface of its Desktop Tool. The following screenshots may no longer be accurate, we are working on updating them.
The Sharegate PowerShell commands now allow users to move multiple SharePoint libraries and lists by simply using the Copy-List cmdlet. Today kids we will focus on the power of this cmdlet with step-by-step instructions on how to migrate multiple lists and libraries in a few PowerShell lines. This process can also be automated by creating a script and configuring a new task through Windows Task Scheduler. For more information on Sharegate automation, check out “Schedule your SharePoint migration using PowerShell and Sharegate”.
To get started, we will highlight the steps needed in order for this to work:
Import the Sharegate Module
Connect to the destination site
Migrate the list from the source to the destination site
Watch the magic of Sharegate and PowerShell make your job simple!
Importing the PowerShell Sharegate Module
The first step is to open of PowerShell and import the Sharegate module. This can be done one of two ways.
Option 1 – Type Import-Module Sharegate into the Management Shell as shown above.
Option 2 – Launch PowerShell in the Sharegate application by selecting the PowerShell icon located on the ribbon in the SharePoint Migration section.
Note: If when trying to import the Sharegate Module you get the following message:
Import-Module: The version of the loaded PowerShell is ‘2.0’. The module ‘C:Program Files (x86)Sharegate MigrationSharegateSharegate.psd1’ requires a minimum PowerShell version of ‘3.0’ to execute. Please verify the installation of the PowerShell and try again.
it means you have an older version of PowerShell and need to upgrade to version 3.0. For more information on how to get version 3.0, check out this Microsoft article Installing Windows PowerShell.
Connect to the SharePoint Migration Destination Site
Now that we have imported the Sharegate module into our current PowerShell window, we will connect to the destination site by creating a variable named $dstSite. This variable will use the Sharegate cmdlet Connect-Site along with the Url attribute to simply connect to the site we want to move the libraries too. In our case we will be connecting to the http://myfarm1/sites/mydestinationsite as our destination of choice.
Migrating the SharePoint Libraries from the Source Site to the Destination Site
The last step we have to execute before we look like expert PowerShell geeks, is to tell PowerShell where the source site is located and what lists (or in our case libraries) we want to copy over to the destination site. Let’s take a look at the PowerShell code and how it works...
First things first, we must connect to the source site http://myfarm1/sites/mysourcesite by specifying the Url attribute. Once we are connected to the source, we then can use the Copy-List cmdlet along with the Name attribute to identify which libraries we want to copy. In our example, we will be copying the MyTitle* and MySpecificTitle libraries to the destination site. As we have mentioned previously, the variable $dstSite has been created to call the destination site.
There you go! It’s as simple as 1,2,3. A Sharegate migration is now simpler than ever with the new PowerShell commands. As we have seen in this post, the commands such as Connect-Site and Copy-List are easy to remember cmdlets that are sure to make your job easier. To learn more about all the available Sharegate PowerShell commands check out our documentation on the subject.
For more resources on migrating lists and libraries you can read the following: