How can I fetch the sites or subsites from a site collection and export them to excel document?

130 Views Asked by At

I've been trying to fetch the subsites from a site collection and export them into excel document, and I've been checking different scripts and testing to get a special one which could help me to get this information, even though none of them have work.

I've tested these two:

https://sposcripts.com/get-all-sites-and-subsites/ https://sharepoint.stackexchange.com/questions/300136/how-can-i-get-all-site-collections-and-sub-sites-inside-a-powershell-script enter image description here

1

There are 1 best solutions below

0
On

You may need to -UseWebLogin to sign in the MFA enabled account. Try using this:

Connect-PnPOnline -Url https://contoso.sharepoint.com -UseWebLogin

OR

Connect-PnPOnline -Url https://contoso.sharepoint.com -PnPManagementShell -LaunchBrowser