EnumWindowsUserInfo 方法 (String)
列舉所有有明確授與存取權給 SQL Server 執行個體的 Microsoft Windows 使用者之相關資訊清單。
命名空間: Microsoft.SqlServer.Management.Smo
組件: Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)
語法
'宣告
Public Function EnumWindowsUserInfo ( _
account As String _
) As DataTable
'用途
Dim instance As Server
Dim account As String
Dim returnValue As DataTable
returnValue = instance.EnumWindowsUserInfo(account)
public DataTable EnumWindowsUserInfo(
string account
)
public:
DataTable^ EnumWindowsUserInfo(
String^ account
)
member EnumWindowsUserInfo :
account:string -> DataTable
public function EnumWindowsUserInfo(
account : String
) : DataTable
參數
- account
型別:System. . :: . .String
String 值,指定要限制其結果的 Windows 使用者帳戶。
傳回值
型別:System.Data. . :: . .DataTable
DataTable 物件值,包含明確授與存取權給 SQL Server 執行個體之 Windows 使用者的清單。下表將描述傳回之 DataTable 的不同資料行。
範例
C#
Server srv = new Server("(local)");
DataTable d = srv.EnumWindowsUserInfo("NT AUTHORITY\\System");
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.EnumWindowsUserInfo("NT AUTHORITY\System")
foreach ($r in $d.Rows)
{
Write-Host "============================================"
Foreach ($c in $d.Columns)
{
Write-Host $c.ColumnName "=" $r[$c]
}
}