PowerShell – Download File from SharePoint Document Library

I am sharing a recently written scripting solution that I have uploaded to PowerShell Gallery as well as GIT.

This solution will download files from SharePoint document library and move it to destination on NAS/file share.

Prerequisites for this solution:

Download the script from Git or PowerShell gallery from below links:

Git:

https://github.com/VikasSukhija/Downloads/blob/master/DownloadSPOFiles.ps1

Powershell Gallery:

https://www.powershellgallery.com/packages/DownloadSPOFiles

Install-Script -Name DownloadSPOFiles


Note: Script will auto generate encrypted password first time it is run and save it in the same folder.

Logs will be stored in their respective folder from where the script is being run.

Here is how you can run it:

.\DownloadSPOFiles.ps1 -siteURL ‘siteurl’ -folderurl ‘/Shared Documents/TECH’ -destination ‘\\fileshare\tss\share’


After running it for first time interactively you can schedule it to run via task scheduler as password has been stored as encrypted credentials inside the script folder.

I hope this PowerShell magic will be useful in case you are in same situation.

 

 

Thanks for reading …

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s