EnumServerAttributes 方法
为 SQL Server 实例枚举服务器属性列表。
命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)
语法
声明
Public Function EnumServerAttributes As DataTable
用法
Dim instance As Server
Dim returnValue As DataTable
returnValue = instance.EnumServerAttributes()
public DataTable EnumServerAttributes()
public:
DataTable^ EnumServerAttributes()
member EnumServerAttributes : unit -> DataTable
public function EnumServerAttributes() : DataTable
示例
C#
Server srv = new Server("(local)");
DataTable d = srv.EnumServerAttributes();
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.EnumServerAttributes()
foreach ($r in $d.Rows)
{
Write-Host "============================================"
Foreach ($c in $d.Columns)
{
Write-Host $c.ColumnName "=" $r[$c]
}
}