次の方法で共有


Get-MasterDataServicesDatabase (PowerShell)

Master Data Services データベースに関する情報を取得します。

構文

Get-MasterDataServicesDatabase [-Server] <Microsoft.MasterDataServices.Configuration.DatabaseServerInformation> [-DatabaseName] <String>

説明

Get-MasterDataServicesDatabase は、データベース情報オブジェクトを返します。このオブジェクトには、SQL Server の指定インスタンスの Master Data Services データベースに関する情報が含まれています。接続文字列の資格情報に指定データベースに対する読み取り権限があることを確認します。

パラメーター

-Server

Server パラメーターは、Get-MasterDataServicesDatabaseServerInformation のデータベース サーバー情報オブジェクトです。このオブジェクトは、Master Data Services データベースをホストする SQL Server のインスタンスへの接続に使用されます。

必須/オプション

必須

位置

0

既定値

なし

パイプライン入力の受け入れ

可 (ByValue)

ワイルドカード文字の受け入れ

不可

-DatabaseName

DatabaseName パラメーターは、情報の取得元である Master Data Services データベースの名前を指定する文字列です。

必須/オプション

必須

位置

1

既定値

なし

パイプライン入力の受け入れ

不可

ワイルドカード文字の受け入れ

不可

入力および出力

入力型は、コマンドレットにパイプできるオブジェクトの型です。戻り値の型は、コマンドレットが返すオブジェクトの型です。

入力

Microsoft.MasterDataServices.Configuration.DatabaseServerInformation、System.String

入力は Get-MasterDataServicesDatabaseServerInformation のデータベース サーバー情報オブジェクト、および情報の取得元である Master Data Services データベースを指定する文字列です。

出力

Microsoft.MasterDataServices.Configuration.DatabaseInformation

Get-MasterDataServicesDatabase は、指定した Master Data Services データベースに関する情報が含まれているデータベース情報オブジェクトを返します。

使用例

出力

このコマンドレットを使用したときに返される出力の例を次に示します。

Name             : MyDatabase
HasAccess        : True
Collation        : SQL_Latin1_General_CP1_CI_AS
ServiceAccount   :
MdsAdministrator :
Server           : Microsoft.MasterDataServices.Configuration.DatabaseServerInformation
IsDatabaseOwner  : True

変数と名前付きパラメーターの使用

次の例では、Get-MasterDataServicesDatabaseServerInformation コマンドレットを使用して、変数 $server を Get-MasterDataServicesDatabase コマンドレットの Server パラメーターで使用するように設定します。これらのパラメーターは、名前付きパラメーターです。

C:\PS>$server = Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password='; 
    Get-MasterDataServicesDatabase -Server $server -DatabaseName 'MyDatabase'

出力のパイプと名前付きパラメーターの使用

次の例では、Get-MasterDataServicesDatabaseServerInformation からの出力を、Get-MasterDataServicesDatabases の Server パラメーターにパイプします。DatabaseName パラメーターは、名前付きパラメーターです。

C:\PS>Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password=' | 
    Get-MasterDataServicesDatabase -DatabaseName 'MyDatabase'

変数と位置パラメーターの使用

次の例では、Get-MasterDataServicesDatabaseServerInformation コマンドレットを使用して、変数 $server を New-MasterDataServicesDatabase コマンドレットの Server パラメーターで使用するように設定します。このパラメーターは位置パラメーターです。

C:\PS>$server = Get-MasterDataServicesDatabaseServerInformation 
    -ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password='; 
    Get-MasterDataServicesDatabase $server 'MyDatabase'