SharePoint List Items Count using Power Shell Script

In this blog, I have explained how to get SharePoint list items count using power shell script.

Follow the below steps:

  1. Create a SharePoint List (say Continents).

    continents

  2. Open the Power Shell ISE as administrator.

  3. Paste the below code after changing site url an your list name.
    1. cls    
    2. add-pssnapin microsoft.sharepoint.powershell    
    3. $URL="http://moss13:1111/"    
    4. $ListName="Continents"    
    5. $SPWeb=Get-SPWeb $URL    
    6. $SPList=$SPWeb.Lists[$ListName]    
    7. $listitems = $SPList.Items.Count     
    8. Write-Host "Items in list: " $listitems   
  4. The output will be as below:

    output