我正在尝试更新数据库连接字符串更改:
Import-Module SqlServer
$newConnectionString = "Connection Timeout=60;User Id=SOME_NEW_ID;Data Source=10.10.19.10;Persist Security Info=True;Session Character Set=UTF8"
$svr = new-Object Microsoft.AnalysisServices.Tabular.Server
$svr.Connect("server1.domain.com")
$svr.databases[1].model.datasources[0].ConnectionString = $newConnectionString
$svr.Databases[1].model.datasources[0].Update(UpdateOptions.ExpandFull)
但我收到错误:
表达式或语句中出现意外的标记“UpdateOptions.ExpandFull”。
如果我定期更新():
$svr.Databases[1].model.datasources[0].Update()
我明白了:
方法调用失败,因为 [Microsoft.AnalysisServices.Tabular.ProviderDataSource] 不包含名为“更新”的方法
如果我尝试SaveChanges():
$svr.Databases[1].Model.SaveChanges()
我收到此错误:
检索成员“SaveChanges”时发生以下异常:“遇到默认值的无效类型。”
如果我尝试ExpandFull
$svr.Databases[1].model.datasources[0].Update(ExpandFull)
我明白了
表达式或语句中出现意外的标记“ExpandFull”。