Powershell 获取连接属性名
下面的脚本具有连接的硬编码名称(TD_名称)。我想让这个变量获取服务器中的连接名Powershell 获取连接属性名,powershell,azure-analysis-services,Powershell,Azure Analysis Services,下面的脚本具有连接的硬编码名称(TD_名称)。我想让这个变量获取服务器中的连接名 write-host "Connections folder > TD_NAME > " 例如,在映像中,变量将获取“Teradata DEV”名称并将其传递到输出消息中 这就是我试图实现的: Import-Module SqlServer $as = New-Object Microsoft.AnalysisServices.Server $as.connect("$Server")
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"
您可以使用AS数据库项目的
DataSources
属性
$c.DataSources.Name
$c.DataSources.ConnectionString
这很熟悉。您是否删除了上一个问题并再次提问?仅供参考,这就是你将如何得到一个问题禁令。请编辑你的文章,包括你需要帮助的脚本。目前,所有这些显示的都是一个
写主机
@jrider添加了我想要实现的功能!顺便说一句,对于连接字符串,它只显示用户ID和服务器。是否可以获取password属性并对其进行更改?根据属性的不同,出于安全原因,会自动删除密码…可以设置ConnectionString…因此无法通过脚本更改密码?否…通过读取属性删除密码…您应该能够设置你能强调一下“设置连接字符串”是什么意思吗?你的意思是设置它来获取密码吗?我有点困惑。。。