we want to migrate our sharepoint on-premises 2013 sit e to SharePoint online. and some document libraries contain very important documents to us. where these docuemnt libraries have minor and major versions enabled. now for the migration we are going to use a top rated migration tool named ShareGate. but as an additional verification step,to make sure everything have been migrated. i want to know if i can write power-shell script which can do these steps (for the on-premises + SharePoint online):-

  1. Inside the on-premises site, to run a power-shell script which loop through all the sub-sites inside a site collection, and display the number of unique minor and major versions for the documents inside the "SharedDocuments" docuemnt library.
  2. then after competing the migration to run a pnp script to show the result inside the migrated online sites.

for example let say i have an on-premises document library which have the follow files:-

  1. fileA. with versions= 0.1 + 0.2 + 1.0
  2. fileB. with versions= 0.1 + 0.2 + 0.11 + 1 +2

so the script should show final result for the document library as 8. can anyone advice on this?

1 Answer 1


ShareGate can do reporting, so one option is to use sharegate to report on both sites, export both sets of reports to two database tables, and run some queries to see if there are any rows without a match.

If you don't want to use ShareGate to audit ShareGate, then use pnp powershell. Since there are versions for both online adn on-prem, you can write a single script that gathers the inventory, run it on only machine that has the online version of pnp, and then run it again on a machine that has the on-prem version on the pnp libraries (or, go through the blog posts to configure running both versions of pnp on one machine)

But again, I'd get the results from powershell, dump them to a sql table, which would then make it simple to compare both result sets.

You could also code the CSOM yourself, which would allow you to skip the database and just do a direct comparison as you'd be able to easily query both systems from the one application, but I like the database idea as it gives you a permanent record.

Edit: Or, perhaps I misunderstood your question? You can retrieve version numbers of a file via the versionlabel property. An example of this is here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.