This module uses the SharePoint Client Side Object Model (CSOM) and all required libraries and dlls are included. Installing the SharePoint binaries is not required for the replication to work
SPReplicator works with both on-prem and SharePoint Online and is currently in beta. Please report any issues to email@example.com.
SPReplicator is now in the PowerShell Gallery. Run the following from an administrative prompt to install SPReplicator for all users:
Or if you don't have administrative access or want to save it locally (just for yourself), run:
Install-Module SPReplicator -Scope CurrentUser
If you're scheduling tasks via Task Schedule or SQL Server agent, installing the module with administrative privileges is best because it will ensure all users have access via Program Files.
For more details about commands, visit the wiki or use Get-Help.
This module can be used for replicating data in a number of ways.
- Between air gapped (offline) servers that do not have direct access to each other
- Directly from SharePoint site collection to SharePoint site collection
- From SQL Server to SharePoint
- From SharePoint to SQL Server
- From CSV to SharePoint
- From SharePoint to CSV
- From On-prem to SharePoint Online and back
SPReplicator has a number of commands that help you manage SharePoint lists. You can view, delete, and add records easily and there's even a command that makes it easy to see internal column names and datatypes.
Export from SharePoint List
Export-SPRListItem -Site https://intranet -List Employees -Path \\nas\replicationdata\Employees.csv
Establish a session to the SharePoint site
You can specify
-Credential with every command. Or you can establish a connection and not worry about specifying the Site or Credentials in subsequent command executions.
There is no need to assign the output to a variable, as it creates a reusable global variable
# using your own account credentials Connect-SPRSite -Site https://intranet # specifying other credentials Connect-SPRSite -Site https://intranet -Credential ad\otheruser # using your own account credentials and SP Online Connect-SPRSite -Site https://corp.sharepoint.com -Credential firstname.lastname@example.org
Import to SharePoint List
Now that we've established a connection via
Connect-SPRSite, we no longer need to specify the Site.
We can import data two ways, using
# Import from CSV Import-SPRListItem -List Employees -Path \\nas\replicationdata\Employees.csv # Import from SQL Server Invoke-DbaQuery -SqlInstance sql2017 -Query "Select fname, lname where id > 100" | Add-SPRListItem -List emps # Import any PowerShell object, really. So long as it has the properly named columns. Get-ADUser -Filter * | Select SamAccountName, whateverelse | Add-SPRListItem -List ADList # Didn't have time to create a good SharePoint list? Use -AutoCreateList Get-ADUser -Filter * | Add-SPRListItem -List ADList -AutoCreateList
Find out more
This was just a subset of command examples. For more command examples, visit the wiki or use Get-Help.
Connect to a site
Add a generic object to a list
Add SQL data to a list and auto create the list if it doesn't exist
This is what it looks like!
Get details about columns to help you format your input/output
Results of built-in logger (New-SPRLogList and
A Power BI Template is included in the bin directory. More coming soon.
This module comes with integration tests! If you'd like to see how I test the commands, check out Integration.Tests.ps1
To find out more about any command, including additional examples, use
Get-Help Get-SPRColumnDetail -Detailed