I've used PnP a fair amount in the past when working with SharePoint Online, I'm now using it against a SharePoint 2016 on-prem environment. However, I'm having trouble getting connected.

The SP2016 farm sits behind ADFS...

When trying to connect, i'm using the following:

Connect-PnpOnline -Url https://collab.myCorp.com -Credentials 'O365Creds' -UseAdfs

I'm using the latest PnP modules, and storing my username and pwd in the credential manager.

The error I'm seeing is:

Connect-PnpOnline : Exception has been thrown by the target of an invocation.
At line:2 char:1
+ Connect-PnpOnline -Url https://coll.myCorp.com -Credentials  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-PnPOnline], TargetInvocationException
    + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,SharePointPnP.PowerShell.Commands.Base.ConnectOnline

If I don't use the -adfs flag (as a test) I see the following error:

Connect-PnpOnline : Cannot contact web site 'https://collab.myCorp.com/' or the web site does not support SharePoint Online credentials. The response status code is
'Forbidden'. The response headers are 'X-SharePointHealthScore=0, SPRequestGuid=c3bf519e-994e-2020-90f3-0c6fe9776187, request-id=c3bf519e-994e-2020-90f3-0c6fe9776187,
X-Forms_Based_Auth_Return_Url=https://collab.myCorp.com/_layouts/15/error.aspx, X-MSDAVEXT_Error=917656;
MicrosoftSharePointTeamServices=, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly, Content-Length=13, Content-Type=text/plain; charset=utf-8,
Date=Fri, 09 Mar 2018 08:10:07 GMT, Server=Microsoft-IIS/8.5, X-Powered-By=ASP.NET'.

Any ideas? Surely what I'm trying to do is pretty basic..


  • @ola - Tried using PnP PowerShell for SharePoint 2016 ? Ideally you shouldnt be using the online version of PnP for OnPrem env because the server side dlls are different Oct 10, 2018 at 12:01
  • 1
    Yes, I try it on SharePoint 2016. I am using the SharePointPnPPowerShell2016 variant. We also using adfs.
    – Ola
    Oct 31, 2018 at 17:27

2 Answers 2


I have the same issue. A workaround is to use the parameter -UseWebLogin.

Connect-PnPOnline -Url https://collab.myCorp.com -UseWebLogin
  • For me it is not working i am getting some refresh error page
    – Liz
    Jun 12, 2020 at 12:05

There are three versions of PnP PowerShell. Are you sure you are running SharePointPnPPowerShell2016? Did you remove SharePointPnPPowerShellOnline? If you haven't, this would be the source of your problem.

This article explains how to run them side by side: Running the various versions of PnP PowerShell side-by-side

Your Answer

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

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