You can add individual Site Collections one at a time in Explorer, or you can add all the site collections from your farm or tenant by connecting to your admin center or central admin.
To connect to a number of specific site collections in Explorer without having to do each connection individually, you can use the -AddToExplorer parameter in a PowerShell script.
Tip: You can also export and import your connections from Explorer to share them with other ShareGate Desktop users.
Index
Add a single Site Collection to Explorer
Copy and paste the following script in the PowerShell application of your choice.
Import-Module Sharegate
$myUsername = "myusername"
$myPassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
Connect-Site -Url "http://yourtenant.sharepoint.com/sites/yoursitecollection" -Username $myUsername -Password $myPassword -AddToExplorer
Adjust your script to make it work for you. Here are a few guidelines:
- $Username and $Password: Replace "myusername" and "mypassword" by your matching SharePoint or Microsoft 365 credentials.
- Connect-Site: If you need to change the authentication method, you will find how to do it in the Connect Site article.
- -URL: Replace the URL to match your site collection's URL.
Run your script once it's property adjusted and tested.
Tip: You can have multiple Connect-Site lines with different URLs to add multiple Site Collections to Explorer with this script. If you have a lot of sites to connect to, we suggest using the CSV method below instead.
Add Multiple Site Collections to Explorer using a CSV
Create a CSV guide for your connections
- Create a new Excel document.
- Name the first column URL.
- List the URLs of all the site collections you want to add to Explorer.
- Save the file as a CSV.
Create your script
Copy and paste the following script in the PowerShell application of your choice.
Import-Module Sharegate
$csvFile = "C:\CSVfile.csv"
$table = Import-Csv $csvFile
$myUsername = "myusername"
$myPassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
foreach ($row in $table) {
Connect-Site -Url $row.URL -Username $myUsername -Password $myPassword -AddToExplorer
}
Adjust your script to make it work for you. Here are a few guidelines:
- $csvFile: Adjust the path so that it points to the CSV file you saved before.
- $myUsername and $myPassword: Replace "myusername" and "mypassword" by your matching SharePoint or Microsoft 365 credentials.
- Connect-site: If you need to change the authentication method, you will find how to do it in the Connect Site article.
- foreach: Loops the commands between the brackets for each row in your CSV file. In this case it adds your connections to Explorer in ShareGate Desktop.
Run your script once it's property adjusted and tested.