Set-MasterDataServicesSystemSetting (PowerShell)

设置 Master Data Services 数据库中指定系统设置的值。

语法

Set-MasterDataServicesSystemSetting [-Database] <Microsoft.MasterDataServices.Configuration.DatabaseInformation> 
        [-Setting] <Microsoft.MasterDataServices.Services.DataContracts.SystemSetting> [-SettingValue <String>]

说明

Set-MasterDataServicesSystemSetting 设置 Master Data Services 数据库中指定系统设置的值。

参数

-Database

Database 参数是 Get-MasterDataServicesDatabase 中的一个数据库信息对象。此对象包含有关要更新的 Master Data Services 数据库的信息。

必需?

true

位置?

0

默认值

接受管道输入

true (ByValue)

接受通配符?

false

-Setting

Setting 参数是一个系统设置对象,该对象指定要更新的系统设置的名称。

必需?

true

位置?

1

默认值

接受管道输入

true (ByValue)

接受通配符?

false

-SettingValue

SettingValue 参数是一个字符串,该字符串指定要为系统设置设置的新值。如果未指定此参数,则使用 Setting 参数中的值。

必需?

false

位置?

所指定位置

默认值

接受管道输入

true (ByPropertyName)

接受通配符?

false

输入和输出

输入类型是可以传送到 cmdlet 的对象的类型。返回类型是 cmdlet 所返回的对象的类型。

输入

Microsoft.MasterDataServices.Configuration.DatabaseInformation、 Microsoft.MasterDataServices.Services.DataContracts.SystemSetting、System.String

“输入”包括数据库信息对象、系统设置对象,以及用于为系统设置指定新值的字符串。

输出

无。

示例

传送输出和使用变量

下例将数据库服务器信息对象从 Get-MasterDataServicesDatabaseServerInformation 传送到 Set-MasterDataServicesSystemSetting。其中获取了“每批行数”系统设置的当前值,然后在 Master Data Services 数据库中更新该值。

C:\PS> # Get the database server information object
$dbInfo = Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial Catalog=;Integrated Security=True;User ID=;Password=' | 
    Get-MasterDataServicesDatabase -DatabaseName 'MyDatabase'; 

# Retrieve the current RowsPerBatch system setting
$rowsPerBatchSetting = $dbInfo | Get-MasterDataServicesSystemSettings | where { $_.DisplayName -eq 'Rows Per Batch'};

# Display the current value of RowsPerBatch
write-host The current setting for RowsPerBatch is $rowsPerBatchSetting.SettingValue;

# Pipe the dbInfo object and set the setting value using the SettingValue parameter
$dbInfo | Set-MasterDataServicesSystemSetting  -Setting $rowsPerBatchSetting -SettingValue '60';

# Retrieve the setting again to see if it was properly updated.
$newRowsPerBatch = $dbInfo | Get-MasterDataServicesSystemSettings | where { $_.DisplayName -eq 'Rows Per Batch' };

# Display the new value of RowsPerBatch.
write-host The new setting for RowsPerBatch is $rowsPerBatchSetting.SettingValue;