Ramu
Ramu

Reputation: 47

powershell how to find Server name from ODBC connection

How to get the Server name, database name from ODBC DSN using PowerShell?
When I execute PS:> Get-OdbcDSN, it shows partial Attribute string. but not full string.

enter image description here

enter image description here

Upvotes: 1

Views: 2235

Answers (2)

Jach
Jach

Reputation: 577

Here is a simple ps script to list out all "Attribute"

$dsn = Get-ODBCDSN -name "yourOdbcDsnHere" 
foreach ($attr in $dsn.Attribute) {
    Write-Output $attr
}

hope this help

Upvotes: 1

postanote
postanote

Reputation: 16116

Change your screen/output formatting settings and or try...

Get-OdbcDSN | 
Select-Object -Property '*' | 
Format-List -Force 

See also:

https://learn.microsoft.com/en-us/powershell/scripting/samples/using-format-commands-to-change-output-view?view=powershell-7.2

Upvotes: 1

Related Questions