• Stars
    star
    38
  • Rank 706,870 (Top 14 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

β™» Replicates SharePoint Lists

SPReplicator

SPReplicator logoSPReplicator is a PowerShell module that helps replicate SharePoint list data.

This module uses the SharePoint Client Side Object Model (CSOM), the PnP.PowerShell module and all required libraries and dlls are included. Installing the SharePoint binaries is not required for the replication to work πŸ‘ Thank you Microsoft for the redistributable nuget and PnP.PowerShell.

SPReplicator works with both on-prem and SharePoint Online and is currently in beta. It also works on .NET Core, so it's cross-platform, and supports Windows, macOS and Linux.

Please report any issues to [email protected].

Installer

SPReplicator is now in the PowerShell Gallery. Run the following from an administrative prompt to install SPReplicator for all users:

Install-Module SPReplicator

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.

Command Reference

For more details about commands, visit the wiki or use Get-Help.

Usage scenarios

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

Usage examples

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 -Site and -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 $global:spsite.

# 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 otheruser@corp.onmicrosoft.com

# using MFA
Connect-SPRSite -Site https://corp.sharepoint.com -AuthenticationMode WebLogin

# using app login
Connect-SPRSite -Site https://corp.sharepoint.com -AuthenticationMode AppOnly -Credential 1e36c5cc-5281-4235-a84f-c94dc2de8800

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-SPRListItem or Add-SPRListItem

# 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.

Selected screenshots

Connect to a site

image

Add a generic object to a list

image

Add SQL data to a list and auto create the list if it doesn't exist

image

This is what it looks like!

image

Get details about columns to help you format your input/output

image

Results of built-in logger (New-SPRLogList and -LogToList)

image

Power BI

A Power BI Template can be downloaded from here.

image

Pester tested

This module comes with integration tests! If you'd like to see how I test the commands, check out Integration.Tests.ps1

image

Learn more

To find out more about any command, including additional examples, use Get-Help.

Get-Help Get-SPRColumnDetail -Detailed

More Repositories

1

eol-dr

A crowd-sourced guide to help techs help their non-tech spouses / partners / parents / kids when we are at the end-of-life
2,212
star
2

kbupdate

πŸ›‘ KB Viewer, Saver, Installer and Uninstaller
PowerShell
326
star
3

discordrpc

Discord Rich Presence Client written in PowerShell
PowerShell
46
star
4

modules

Modules like Invoke-CsvSqlcmd
PowerShell
46
star
5

mssqlsuite

A GitHub Action that automatically install SQL Server suite of tools
PowerShell
39
star
6

tentools

πŸ’™ tenable.sc / nessus / acas powershell module
PowerShell
38
star
7

psmodulecache

This action makes caching PowerShell modules from the PowerShell Gallery easy for Linux, Windows and macOS runners.
PowerShell
29
star
8

fossilize

Mastodon Backup GitHub Action
PowerShell
19
star
9

psu-themes

Themes for PowerShell Universal
PowerShell
14
star
10

twitch

πŸ€– twitch.tv API client and chatbot written in PowerShell
PowerShell
14
star
11

nowcastnotify

cute lil thing for june
PowerShell
11
star
12

SqlImportSpeedTest

Join in! Goal is 500k, now at 232k.
PowerShell
11
star
13

dbatools.ai

πŸ€– PowerShell Copilot and helpful assistant for SQL Server databases and dbatools. Mostly, though, a teaching tool.
PowerShell
11
star
14

exodus

Helps Twitter communities find members on Mastodon. Searches lists, hashtags, account followers and more for Mastodon links and exports them to an importable CSV file.
PowerShell
8
star
15

postprofile

Faster PowerShell Profiles
PowerShell
7
star
16

scripts

Various scripts like Invoke-Locate.ps1
PowerShell
6
star
17

dbatools-demo

just a lil demo
PowerShell
6
star
18

devcontainers

Dev Containers, Codespaces and more for Azure PowerShell Function Apps
PowerShell
6
star
19

finetuna

An OpenAI Fine Tuner written in PowerShell
PowerShell
6
star
20

cl

⚑ simplified config and logging for PowerShell
5
star
21

PSPostgres

PowerShell binary module for Postgres
C#
5
star
22

azuright

GitHub Action that installs azurite
PowerShell
5
star
23

PSHelp.Copilot

πŸš€ Natural language PowerShell module interaction through OpenAI integration
PowerShell
5
star
24

stigiis

πŸ¦… DISA STIG automation module for IIS
PowerShell
4
star
25

disarepotools

πŸ¦… DISA Patch Repository Tools - List, download files and install files from DISA patch repositories using your smartcard
PowerShell
4
star
26

MSConnect

Scripts and CSVs relating to connect.microsoft.com/SQLServer and twitter.com/closedasfixed
PowerShell
4
star
27

potatoqualitee

3
star
28

influx

Import CSV files to Mastodon for follows, mutes, bookmarks and more
PowerShell
3
star
29

release

manual releases
3
star
30

vscode-filename-searcher

Adds a searchable sidebar to VS Code that lists files in your workspace and lets you open them in a new window.
TypeScript
3
star
31

pastel

PowerShell Crescendo module for pastel
PowerShell
3
star
32

xevents-demo

PowerShell
2
star
33

psonlinux

2
star
34

vscode-dbatools-search

πŸ”Ž Search dbatools for selected text from VS Code
TypeScript
2
star
35

ogimage

Generates Open Graph images (OG:Image) to give your links more context on social media shares.
PowerShell
2
star
36

releases

automatic releases
1
star
37

bin

Supporting files for modules
PowerShell
1
star
38

mastodon-alias

Sample GitHub Pages repo to show how to alias a domain
1
star
39

api-demo

The demo for the Beautiful API presentation I did.
PowerShell
1
star
40

disatools

πŸ¦… DISA STIG automation toolkit
1
star
41

azfun

PowerShell
1
star
42

pspublish

Update module version and Publish to the PowerShell Gallery
1
star
43

psplaywright

JavaScript
1
star
44

stigtools

HTML
1
star
45

aidertools

PowerShell wrapper for the Aider code assistant
PowerShell
1
star
46

assistants-chat-extension

A GitHub Copilot Chat Extension that integrates OpenAI Assistants
TypeScript
1
star
47

aitoolkit

PowerShell module for interacting with local AI models through Microsoft's AI Toolkit for Visual Studio Code.
PowerShell
1
star