I'm running the powershell code below to get the value of two columns for each item in a document library but the dept2 field is always blank.
I've tried with fields set as text field, choice and managed metadata - dont know if this makes a difference but end game is to check against a managed metadata field.
item.title and item.name appear as expected, just not the fields i've created - i have check and the internal field names.
$SPSite = New-Object Microsoft.SharePoint.SPSite("http://PATH TO SITE/")
$SPWeb = $SPSite.OpenWeb()
$SPList = $SPWeb.Lists["Shared Documents"]
foreach ($listItem in $splist.Items)
Write-Host $listItem.title $listItem.dept2