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
You may need to -UseWebLogin to sign in the MFA enabled account. Try using this:
OR