获取连接属性名称

时间:2018-10-22 14:20:36

标签: powershell azure-analysis-services

以下脚本在此处具有连接的硬编码名称(TD_NAME)。我想将此变量设置为获取服务器中的连接名称。

write-host "Connections folder > TD_NAME > "

例如,在图像中,变量将获取“ Teradata DEV”名称,并将其传递到输出消息中。

connection_name

这就是我要实现的:

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"

1 个答案:

答案 0 :(得分:1)

您可以使用AS数据库对象的DataSources属性

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