2

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

  1. How to get all sub sites in a site?
  2. 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?

1
  • Your question is a bit unclear, I have tried rewording it but I still not fully grasp it. Can you please try to edit it to clarify it more? Feb 22, 2016 at 10:11

2 Answers 2

1

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"
}
4
  • hi how i use this code, please can you guide me, and how i display which page is dynamic and static?
    – adilahmed
    Feb 22, 2016 at 10:22
  • 1.Copy the code 2.Change the webapplication url 3.paste the code in powershell and run it. Feb 22, 2016 at 10:24
  • Hi i need only sitemap information for a site under a webapplication, for example: productweb.com/prodSite
    – adilahmed
    Feb 22, 2016 at 10:29
  • HI here in the code how to extend the width of the url et-SPSite $siteColl | Get-SPWeb -Limit All | Select Title, Url
    – adilahmed
    Feb 22, 2016 at 12:04
0
#Retrieve all site collection infos
Connect-SPOService -Url $AdminUrl -Credential $Credentials
$sitesInfo = Get-SPOSite

#Retrieve and print all sites
foreach ($site in $sitesInfo)
{
    Write-Host 'Site collection:' $site.Url
    $AllWebs = Get-SPOWebs -Url $site.Url -Credential $SPOCredentials
    $AllWebs | %{ Write-Host $_.Title }
    Write-Host '-----------------------------'
}
11
  • what is sposite in Connect-SPOService -Url $AdminUrl -Credential $Credentials
    – adilahmed
    Feb 22, 2016 at 10:55
  • $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("username", $password) $AdminUrl = "site/sites/test" Feb 22, 2016 at 10:58
  • i get error when run above line PS C:\Users\spadmin> $credentials = New-Object Microsoft.SharePoint.Client.Share PointOnlineCredentials New-Object : A constructor was not found. Cannot find an appropriate constructor for type Microsoft.SharePoint.Client.SharePointOnlineCredentials. At line:1 char:16 + $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredential ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    – adilahmed
    Feb 22, 2016 at 11:29
  • check your user name and password Feb 22, 2016 at 11:31
  • Add this line in your top of the code Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Feb 22, 2016 at 11:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.