Read SharePoint List Item in Tabular form using PowerShell Script

Prerequisite

SharePoint custom list (say continents) with some records as below:
 
 
Open the powershell ISE with run as administrator and run the below  code:
  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. $SPListItems = $SPList.Items | Where {  
  8.     $_['ID'] - ge 1  
  9. }  
  10. Write - Host("|{0,3}|{1,15}|{2,12}|{3,10}|" - f 'ID''Title''Area',  
  11.     'Population') - ForegroundColor yellow  
  12. Write - Host("________________________________________________")  
  13. $Items = $SPListItems | ForEach - Object {  
  14.     Write - Host("|{0,3}|{1,15}|{2,12}|{3,10}|" - f $_['ID'], $_['Title'],  
  15.     $_['Area'], $_['Population']) - ForegroundColor yellow  
  16. }  
  17. Write - Host("________________________________________________")  
Output will be as below-
 
 
Ebook Download
View all
Learn
View all