Forum Discussion

CardinalNight's avatar
CardinalNight
Brass Contributor
Nov 20, 2023
Solved

Get-PnPSite or Get-PnPWeb error File Not Found

I am using this version of PS:
Major Minor Build Revision
-----    -----   -----   --------
5           1      19041    3570

I have also installed PnP for PowerShell.

I am attempting this:

$tenant = "myCompany"
Write-Host "Connecting to https://$($tenant)-admin.sharepoint.com..."
Connect-PnPOnline -Url "https://myCompany-admin.sharepoint.com"
Get-PnPWeb -Identity "https://myCompany.sharepoint.com/sites/mySite"

But I'm getting an error saying:

Get-PnPWeb : File Not Found.
At line:4 char:1
+ Get-PnPWeb -Identity "https://myCompany.sharepoint.com/sites/MyCompan...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-PnPWeb], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.GetWeb

I've read ALL existing MS documentation and even the PnP docs, but nothing shows how to do it.
My objective is to connect to the tenant (this works) then get a specific site so I can start adding items to it.

  • Harm_Veenstra's avatar
    Harm_Veenstra
    Nov 22, 2023

    CardinalNight Did that work out for you?

    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.

    If one of the posts was helpful in other ways, please consider giving it a Like.

5 Replies

    • CardinalNight's avatar
      CardinalNight
      Brass Contributor
      Hi - yes that works but the error comes from
      Get-PnPWeb -Identity "https://myCompany.sharepoint.com/sites/mySite"
      I get a "File not Found"
      • Harm_Veenstra's avatar
        Harm_Veenstra
        MVP

        CardinalNight Did that work out for you?

        Please click Mark as Best Response & Like if my post helped you to solve your issue.
        This will help others to find the correct solution easily. It also closes the item.

        If one of the posts was helpful in other ways, please consider giving it a Like.

Resources