Cataster
Cataster

Reputation: 3521

Getting connection property name

The following script here has a hardcoded name of a connection (TD_NAME). i would like to make this a variable that fetches the connection name as it is in the server.

write-host "Connections folder > TD_NAME > "

for example, in the image, the variable would grab the "Teradata DEV" name and pass it in the output message.

connection_name

This is what i am trying to implement:

Import-Module SqlServer

$as = New-Object Microsoft.AnalysisServices.Server  
$as.connect("$Server")  

$c = $as.Databases | Where-Object { $_.ID -eq $Database } #this gets the CUBE to get its relevant connection property

### Here goes whatever the code is that will expand the connection folder (if necessary) and get the connection name ###
#Example: 
# $TD_NAME = c.connectionsomething...

write-host "Processing job failed!`r`nCheck the TD credentials by expanding the CUBE Connections folder > $TD_NAME > Properties > Connection String"

Upvotes: 0

Views: 118

Answers (1)

Peter Schneider
Peter Schneider

Reputation: 2929

You can use the DataSources property of the AS Database oject

$c.DataSources.Name
$c.DataSources.ConnectionString

Upvotes: 1

Related Questions