.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

SharePoint Application Information PowerShell Scripts

Posted By:Jean Paul       Posted Date: September 22, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we can explore the necessary scripts to generate SharePoint Application Information.
 

I have consolidated all the scripts to generate an HTML file.

  1. Web Applications
  2. Site Collections
  3. Sites
  4. Lists

Click on the following button to download the script.

image

After download, unzip the zip file, right click on PS1 file & choose the Run with PowerShell option.

image

 

 

Following is the PowerShell script to get all Web Applications:
# Get Web Applications
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs) 
{
    foreach ($webapp in $websvc.WebApplications) 
    {
        echo $webapp.Name
    }
}
Following is the PowerShell script to get all Site Collections:
# Get Site Collections
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs) 
{
    foreach ($webapp in $websvc.WebApplications) 
    {
         foreach ($site in $webapp.Sites) 
         {
            echo $site.HostName $site.Url $site.LastContentModifiedDate $site.ContentDatabase.Name $site.WebApplication.Name
         }         
    }
}
Following is the PowerShell script to get all Sites:
# Get Sites
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs) 
{
    foreach ($webapp in $websvc.WebApplications) 
    {
         foreach ($site in $webapp.Sites) 
         {
             foreach ($web in $site.AllWebs) 
             {
                 echo $web.Title $web.Url $web.Created $web.LastItemModifiedDate $web.WebTemplate $web.Site.Url
             }
         }         
    }
}
Following is the PowerShell script to get all Lists:
# Get Lists
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs) 
{
    foreach ($webapp in $websvc.WebApplications) 
    {
         foreach ($site in $webapp.Sites) 
         {
             foreach ($web in $site.AllWebs) 
             {
                 foreach ($list in $web.Lists) 
                 {
                     echo $list.Title $list.DefaultViewUrl $list.Created $list.LastItemModifiedDate $list.ItemCount $list.IsApplicationList $list.ParentWeb.Url 
                 }
             }
         }         
    }
}
Following is the PowerShell script to get all Items:
# Get Items
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs) 
{
    foreach ($webapp in $websvc.WebApplications) 
    {
         foreach ($site in $webapp.Sites) 
         {
             foreach ($web in $site.AllWebs) 
             {
                 foreach ($list in $web.Lists) 
                 {
                    foreach ($item in $list.Items) 
                    {
                         echo $item.DisplayName
                     }
                  }
             }
         }         
    }
}

Screen Shots

On running the script, an HTML file will be generated in the same directory, which would look like below.

clip_image001

clip_image003

clip_image005

clip_image007

The same script is available here too:

http://www.sharepointcto.com/PowerShell/PowerShell.aspx

The same information is available through Squadron as well:

http://www.sharepointcto.com/Squadron/Default.aspx

Summary

In this article we have explored the SharePoint Application Information PowerShell scripts. I hope this will be useful in real world scenarios. Please find the source code attached.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend