Q:

Get all links in a site and all subsites using Powershell

We have a public facing site
 www.productsMainsite.com is our main web application 
i need only pages and sites information for a site under a web application, for example: 
www.productsMainsite.com/prodSite
www.productsMainsite.com/prodSite/Prodcut1
- www.productsMainsite.com/prodSite/product1/pages/page1.aspx
www.productsMainsite.com/prodSite/Prodcut2
-www.productsMainsite.com/prodSite/Prodcut2/pages.page1.aspx

How to get all sub sites in a site?
How to get all pages in a sub site and a site ?
using power shell or from Central administration site

and
in this public facing site some pages static and dynamic how i get this information from power shell?

A:

Try this,
## SharePoint DLL  
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$webApplicationURL = Read-Host "Enter Web application"
$webApp = Get-SPWebApplication $webApplicationURL

if($webApp -ne $null)
{
    #Write-Host "Web Application : " + $webApp.Name
    foreach($siteColl in $webApp.Sites)
    {
        if($siteColl -ne $null)
        {
            Write-Host -foregroundcolor red "Site Collection: "$siteColl.Url
            Get-SPSite $siteColl | Get-SPWeb -Limit All | Select Title, Url
        }
        else
        {
            Echo $siteColl "does not exist"
        }
    }
}
else
{
    Write-Host  $webApplicationURL "does not exist, check the WebApplication name"
}

