Accessing Sage 300 ODBC via powershell [Sage][SQLEngine] (31830) Username and password is required.

SOLVED

I am trying to establish a ODBC connection to Sage 300 using Powershell ODBC. 

I am getting below error. I have tried using the same username and password for importing via ODBC in MS Access and it works. 

What am I missing?

Exception calling "Open" with "0" argument(s): "ERROR [28000] 
[Sage][SQLEngine] (31830) Username and password is required.
ERROR [28000] [Sage][SQLEngine] (31830) Username and password is required."

+    $conn.open()
+    ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE 
   xception
    + FullyQualifiedErrorId : OdbcException

My DSN is called
TimberlineDataSource (System DSN. I also have a user DSN that I have tried.
I am using powershell 32 bit.
Here is my script -

function Get-ODBC-Data{
param([string]$query=$(throw 'query is required.'))

$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString = "DSN=TimberlineDataSource;UID=username;PWD=pass;DatabaseType=1;DBQ={E:\Timberline Data\Data\Folder\};DictionaryMode=0;Driver={C:\Program Files (x86)\Timberline Office\Shared\tssimba.dll};MaxColSupport=1536;ShortenNames=0;StandardMode=1;"
$conn.open()
$cmd = New-object System.Data.Odbc.OdbcCommand($query,$conn)
$ds = New-Object system.Data.DataSet
(New-Object system.Data.odbc.odbcDataAdapter($cmd)).fill($ds) | out-null
$conn.close()
$result = $ds.Tables[0]
Write-Host $result


}


if ($env:Processor_Architecture -ne "x86")
{ write-warning 'Launching x86 PowerShell'
&"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" -noninteractive -noprofile -file $myinvocation.Mycommand.path -executionpolicy bypass
exit
}
"Always running in 32bit PowerShell at this point."
$env:Processor_Architecture

Get-ODBC-Data -query "SELECT * FROM sys.objects;"