Today I found out that there is a difference between $null and [DBNull] in powershell. One of my projects uses a MySQL DB, a newer query returns null data depending on a few scenarios. Because of this my process would fail as the null value wasn’t being handled correctly. After some digging it turns out that when querying a DB there is a difference between nulls.
$result.SalesOrder -eq $null
$result.SalesOrder -eq [DBNull]::Value
idAccount : 0017000000r3333
AccountName : 1009333
DateCreated : 03/02/2015 12:14:09
HomeFolder : 0