IT Process Automation

Expand all | Collapse all

Unable to export Contact_uuid using power shell

Jump to Best Answer
  • 1.  Unable to export Contact_uuid using power shell

    Posted 10-17-2018 09:09 AM

    Hi Team ,

     

    I have tried using Powershell in Process Automation to export the contact_uuid but that did not give me any data in Export.csv file it simply shows System.Byte instead.

     

    Script which i am using : "$sel=Invoke-Sqlcmd -Query "select TOP 100 contact_uuid from [mdb].[dbo].ca_contact where userid != 'NULL'" -ServerInstance "sdepdbs036\dbs01" -Username "username" -Password "Password!"
    $array =@()
    foreach($r in $sel)
    {

    write-host $r
    $array += $r
    }
    $array | select "contact_uuid" | Export-Csv "D:\cotact_list.csv" -Force -NoTypeInformation
    [System.Data.SqlClient.SqlConnection]::ClearAllPools()



  • 2.  Re: Unable to export Contact_uuid using power shell
    Best Answer

    Posted 10-17-2018 09:07 PM

    Try this in your query:

    USE mdb SELECT TOP 100 [dbo].[hex](contact_uuid) AS cnt_id FROM [dbo].[ca_contact] where userid != 'NULL'



  • 3.  Re: Unable to export Contact_uuid using power shell

    Posted 10-18-2018 01:54 AM

    thanks Lindsay that worked for me