troubleshooting Question

Powershell putting spaces bewteen string on database pull

Avatar of kdeutsch
kdeutschFlag for United States of America asked on
5 Comments1 Solution392 ViewsLast Modified:
I am pulling some information from a database to first queury AD and its putting spaces in a string that I am pulling.  In the Db I store a number as a string becuase to leading or ending zeros and then pull as a string and format as a string but my poweshell script is putting spaces in between teh numbers.

$Sql = "Select intUserId, strLogon, strEDIPI from iMAC_Users where bitUpdate = 1"
$cmd = New-Object$Sql, $conn)
$rdr = $cmd.ExecuteReader()

        $UserId =($rdr["intUserId"].tostring())
        $Sam =($rdr["strLogon"].tostring())
        $Edipi =($rdr["strEdipi"].tostring())

Write-Host $UserId
Write-Host $Sam
Write-host @Edipi

the id and same name are fin but the @Edipi should come out as a 10 number field such as

but it comes out as this
1 2 3 4 5 6  7 8 9 5
"Batchelor", Developer and EE Topic Advisor
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros