I'm trying to get columns in a list from the display name, however this isn't always working. Here is where I try to get the column, and check to see if it's null. I've tried it on display names without and with spaces. Sometimes it works, sometimes it doesn't. The display names haven't been changed.
$column = $list.Fields[$columnName]
if($column -ne $null)
Thanks for your help.