此处的以下脚本具有连接的硬编码名称 (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"