This PowerShell tutorial, how to resolve net System error 2240 has occurred The user is not allowed to log on from this workstation error in PowerShell SharePoint Online.
Recently we got one requirement to copy documents from shared drive to a SharePoint online document library using PowerShell. In that PowerShell command, we were providing the shared drvie ip address, username, and password. And then we were using the net use command like below:
$fileDirectory="\\IP Address\FolderName"
$username = "Domain\Username"
$password = "Password"
net use $fileDirectory $password /USER:$username
But in the above line it was giving the below error:
net : System error 1219 has occurred.
At C:\Users\Bijaya.Sahoo\Desktop\laregefileupload.ps1:45 char:1
+ net use $fileName $password /USER:$username
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (System error 1219 has occurred.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
The user is not allowed to log on from this workstation.
The full error looks like below:
net System error 2240 has occurred
Here first thing you need to check is the domain name should be same (workstation and shared drive one).
If you are using a vpn, then you can execute the code outside of the vpn.
Read some SharePoint PowerShell tutorials:
- Enable or Disable List Throttling using PowerShell in SharePoint 2013
- Bulk SharePoint Online Site Collection Creation using PowerShell
- Delete Hidden Web Application in SharePoint 2013 using PowerShell
- Hide Document Library or Lists using PowerShell in SharePoint 2016 or SharePoint 2013
- Increase SharePoint Online Storage Quota using PowerShell
- PowerShell global variable
- Exception calling ExecuteQuery with 0 argument(s): Unable to connect to the remote server SharePoint
- The term is not recognized as the name of a cmdlet function PowerShell
- Multiple connections to a server or shared resource by the same user rename computer
- Backup-SPSite : The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program
- Cannot be loaded because the execution of scripts is disabled on this system while running PowerShell
- SharePoint Online: Remove-SPOSite Access denied
If both the things did not work, you can check with your admin team, if they have put any restrictions.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com