Server.EnumDatabaseMirrorWitnessRoles Server.EnumDatabaseMirrorWitnessRoles Server.EnumDatabaseMirrorWitnessRoles Method

Definition

Enumerates a list of database mirror witness roles.

Overloads

EnumDatabaseMirrorWitnessRoles() EnumDatabaseMirrorWitnessRoles() EnumDatabaseMirrorWitnessRoles()

Enumerates a list of database mirror witness roles.

EnumDatabaseMirrorWitnessRoles(String) EnumDatabaseMirrorWitnessRoles(String) EnumDatabaseMirrorWitnessRoles(String)

Enumerates a list of mirror witness roles for the specified database.

EnumDatabaseMirrorWitnessRoles() EnumDatabaseMirrorWitnessRoles() EnumDatabaseMirrorWitnessRoles()

Enumerates a list of database mirror witness roles.

public:
 System::Data::DataTable ^ EnumDatabaseMirrorWitnessRoles();
public System.Data.DataTable EnumDatabaseMirrorWitnessRoles ();
Public Function EnumDatabaseMirrorWitnessRoles () As DataTable
Returns

A DataTable object value that contains the database mirror witness role information.

Examples

C#

Server srv = new Server("(local)");  

DataTable d = srv.EnumDatabaseMirrorWitnessRoles();  
foreach (DataRow r in d.Rows)  
{  
   Console.WriteLine("============================================");  
   foreach(DataColumn c in d.Columns)  
   {  
      Console.WriteLine(c.ColumnName + " = " + r[c].ToString());  
   }  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$d = $srv.EnumDatabaseMirrorWitnessRoles()  

Foreach ($r in $d.Rows)  
{  
   Write-Host "============================================"  
   Foreach ($c in $d.Columns)  
   {  
      Write-Host $c.ColumnName "=" $r[$c]  
   }  
}  

EnumDatabaseMirrorWitnessRoles(String) EnumDatabaseMirrorWitnessRoles(String) EnumDatabaseMirrorWitnessRoles(String)

Enumerates a list of mirror witness roles for the specified database.

public:
 System::Data::DataTable ^ EnumDatabaseMirrorWitnessRoles(System::String ^ database);
public System.Data.DataTable EnumDatabaseMirrorWitnessRoles (string database);
Public Function EnumDatabaseMirrorWitnessRoles (database As String) As DataTable
Parameters
database
String String String

A String value that specifies database for which to return mirror witness roles information.

Returns

A DataTable object value that contains the database mirror witness role information.

Examples

C#

Server srv = new Server("(local)");  

DataTable d = srv.EnumDatabaseMirrorWitnessRoles("AdventureWorks2012");  
foreach (DataRow r in d.Rows)  
{  
   Console.WriteLine("============================================");  
   foreach(DataColumn c in d.Columns)  
   {  
      Console.WriteLine(c.ColumnName + " = " + r[c].ToString());  
   }  
}  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$d = new-object System.Data.Datatable  
$d = $srv.EnumDatabaseMirrorWitnessRoles("AdventureWorks2012")  

Foreach ($r in $d.Rows)  
{  
   Write-Host "============================================"  
   Foreach ($c in $d.Columns)  
   {  
      Write-Host $c.ColumnName "=" $r[$c]  
   }  
}  

Applies to