【发布时间】:2018-06-27 15:50:51
【问题描述】:
使用 SQL2017 版本 14.0.1.439。我需要使用 Powershell 更改表格数据库中 Connections 的 dataSource 路径。
这是我的代码:
$ServerName="localhost\tabular"
$loadInfo =
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($ServerName)
if ($server.name -eq $null) {
Write-Output ("Server '{0}' not found" -f $ServerName)
break
}
foreach ($d in $server.Databases )
{
Write-Output ( "Database: {0}; Status: {1}; Size: {2}MB; Data Sources: {3} " -f $d.Name, $d.State, ($d.EstimatedSize/1024/1024).ToString("#,##0"), $d.DataSources.Count )
}
我的问题,$d.DataSources.Count 总是 0。
我正在寻找一些用 PS 编辑它的方法。
【问题讨论】:
-
向我们展示你得到的输出。
标签: sql powershell ssas-tabular sql-server-2017