0

此处的以下脚本具有连接的硬编码名称 (TD_NAME)。我想让它成为一个变量,以获取服务器中的连接名称。

write-host "Connections folder > TD_NAME > "

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

连接名称

这就是我想要实现的:

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"
4

1 回答 1

1

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

$c.DataSources.Name
$c.DataSources.ConnectionString
于 2018-10-22T20:14:30.590 回答