Here in this post, we will discuss how we can upload bulk documents to SharePoint 2016 document library using PowerShell. The same PowerShell script also works fine in SharePoint 2013 also.
Upload bulk documents to SharePoint document library
Here we will upload documents to the default “Documents” document library which is there in SharePoint 2016. I have a folder in my local drive which contains few files.
We will upload those files to the SharePoint 2016 document library by using PowerShell.
Also read: Upload large files to SharePoint online document library using PowerShell csom
Below is the PowerShell script which you can run in PowerShell ISE.
function UploadDocuments($destination, $File)
{
$securePassword=ConvertTo-SecureString "Qwe@12345" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential("MYSP\Administrator",$securePassword)
$webclient=New-Object System.Net.WebClient
$webclient.Credentials=$credentials
$webclient.UploadFile($destination+"/"+$File.Name,"PUT",$File.FullName)
}
$destination="http://mypc:29024/sites/HydTraining/Shared%20Documents/"
$fileDirectory="E:\Users\Administrator\Desktop\FilesToUpload\*.*"
foreach($fileName in Get-ChildItem $fileDirectory)
{
UploadDocuments -destination $destination -File $fileName
Write-Output "Upload file " $fileName
}
Write-Host "Documents uploaded successfully"
Once you run the script, you will see files will be uploaded to document library like below:

Multiple connections to a server or shared resource by the same user rename computer
Recently while working with PowerShell to copy files from local drive to SharePoint document library I got the below error: Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.
The full error message looks like below:
net : System error 1219 has occurred.
At C:\Users\Bijaya.Sahoo\Desktop\LargeFileUpdated.ps1:181 char:1
+ net use $fileDirectory /USER:$username $password
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (System error 1219 has occurred.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

multiple connections to a server or shared resource by the same user rename computer
The fix the error multiple connections to a server or shared resource by the same user rename computer, run the below command:
net use * /delete
This is how to fix error multiple connections to a server or shared resource by the same user rename computer.
Read some PowerShell tutorials:
- How to send email using PowerShell in Office 365
- Increase SharePoint Online Storage Quota using PowerShell
- Create web application in SharePoint 2016 from Central Administration and using PowerShell
- Delete list items created before N days using PowerShell in SharePoint Online
- Bulk SharePoint Online Site Collection Creation using PowerShell
- Get features (with hidden) using PowerShell in SharePoint 2013/2016
I hope this article will help you to upload documents to SharePoint 2016/2013 document library.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com