pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
679 stars 348 forks source link

[BUG] Connect-PnPOnline: Host not reachable #3329

Closed AlyaKoni closed 1 year ago

AlyaKoni commented 1 year ago

Reporting an Issue or Missing Feature

Issue

Expected behavior

Connection works as in the past

Actual behavior

Connect-PnPOnline -Url https://tenant.sharepoint.com -Interactive
Connect-PnPOnline: Host not reachable

PowerShell version

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

What is the version of the Cmdlet module you are running?

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   2.2.0                 PnP.PowerShell                      Desk      {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagVal…

Other loaded modules

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   7.0.0.0               Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}  
Manifest   7.0.0.0               Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Ge…Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}        
Manifest   1.0.0.0               NetTCPIP                            {Find-NetRoute, Get-NetCompartment, Get-NetIPAddress, Get-NetI…Script     1.4.8.1               PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageP…Manifest   2.2.0                 PnP.PowerShell                      {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-P…Script     0.2.0                 PowerShellEditorServices.Commands   {Clear-Host, ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent,…Binary     0.2.0                 PowerShellEditorServices.VSCode     {Close-VSCodeHtmlContentView, New-VSCodeHtmlContentView, Set-V…Script     2.2.5                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapabil…Script     2.2.6                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSRead…

Which operating system/environment are you running PnP PowerShell on?

Windows 10
tarjeieo commented 1 year ago

I had the same issue when I used Az, if I connected with Az first I got this error connecting to SharePoint. If I connected to SharePoint with Connect-PnPOnline first, I didn't have this issue. I suspect they are both depending on different versions of same .dlls, and the order of loading is important. See also https://github.com/pnp/powershell/discussions/3193

benniemc2002 commented 1 year ago

I have the same issue every time after an install. Works first time, but close session and restart I get the same error. Can clean up by uninstalling module and reinstalling but then repeats. Version 2.2.0 or the latest nightly have same behavior.

PS C:\Users\SRV-QlikView> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
gautamdsheth commented 1 year ago

Thanks for reporting the issue. Have improved the check for the site collection via https://github.com/pnp/powershell/pull/3337, please test it out with tomorrow's nightly build and let us now if the issue still exists.

It will also be available in the next major version whenever we release it.