Skip to content

List-OutlookInbox

Lists Outlook's Inbox

try {
	$Outlook = New-Object -com Outlook.application
	$MAPI = $Outlook.GetNameSpace("MAPI")
	$Inbox = $MAPI.GetDefaultFolder(6) # 6 = olFolderInbox
	$Inbox.items | Select Received,Subject | Format-Table -AutoSize
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.