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 執行個體。
必要項? |
true |
位置? |
0 |
預設值 |
無 |
接受管線輸入 |
true (ByValue) |
接受萬用字元? |
false |
-DatabaseName
DatabaseName 參數是字串,指定要從中取得資訊的 Master Data Services 資料庫名稱。
必要項? |
true |
位置? |
1 |
預設值 |
無 |
接受管線輸入 |
false |
接受萬用字元? |
false |
輸入和輸出
輸入類型是可透過管道傳送至指令程式的物件類型。傳回類型是指令程式所傳回的物件類型。
輸入 |
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 指令程式,設定 Get-MasterDataServicesDatabase 指令程式中的 Server 參數所用的 $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-MasterDataServicesDatabase 中的 Server 參數,這個範例透過管道將輸出從 Get-MasterDataServicesDatabaseServerInformation 傳送到 Get-MasterDataServicesDatabase。DatabaseName 參數是具名參數。
C:\PS>Get-MasterDataServicesDatabaseServerInformation
-ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password=' |
Get-MasterDataServicesDatabase -DatabaseName 'MyDatabase'
使用變數和位置參數
這個範例使用 Get-MasterDataServicesDatabaseServerInformation 指令程式,設定 New-MasterDataServicesDatabase 指令程式中的 Server 參數所用的 $server 變數。這些參數是位置參數。
C:\PS>$server = Get-MasterDataServicesDatabaseServerInformation
-ConnectionString 'Data Source=MyServer\MyInstance;Initial catalog=;Integrated Security=True;User ID=;Password=';
Get-MasterDataServicesDatabase $server 'MyDatabase'