List all items in a SharePoint list through PowerShell

Scenario: You have the SharePoint list: http://sps-pbnet:9595/Lists/MyList/ that has 9 items. You want to list those items using PowerShell

Solution: Use the script below:

PS C:\Users\Administrator.CORP> $webURL=”http://sps-pbnet:9595″
PS C:\Users\Administrator.CORP> $ListName=”MyList”
PS C:\Users\Administrator.CORP> $spweb=Get-SPWeb $webURL
PS C:\Users\Administrator.CORP> $splist=$spweb.Lists[$ListName]
PS C:\Users\Administrator.CORP> $splistitems=$splist.Items
PS C:\Users\Administrator.CORP> $splistitems | ft -a name, displayname, id, uniqueid

The results will be displayed like below: 

Name DisplayName ID UniqueId
—- ———– — ——–
item1 item1 1 075947f1-9e52-4fe2-a972-32ece12b1a14
item2 item2 2 ef508631-e717-419d-9f3a-5fb3dabf77fb
item3 item3 3 84cd5701-af63-45a0-9c3e-fccbc4e06b61
item4 item4 4 8e6e7d7a-741e-4596-b7c9-740313aa8c44
item5 item5 5 4f00495d-1299-48a9-a273-50a4ad8f858d
item6 item6 6 2e8054f7-9105-4a71-836e-153ec57fb05f
item7 item7 7 7f31f7e1-e4de-4860-88ea-2f34cdff605b
item8 item8 8 bbc993a7-65ed-4a6a-b213-495a4898a444
item9 item9 9 35ce144b-6dd3-4f5e-b23e-3ad09499abca