ConnectionOptions.Authority Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает центр, используемый для проверки подлинности указанного пользователя.
public:
property System::String ^ Authority { System::String ^ get(); void set(System::String ^ value); };
public string Authority { get; set; }
member this.Authority : string with get, set
Public Property Authority As String
Значение свойства
Возвращает значение, определяющее String центр, используемый для проверки подлинности указанного пользователя.
Примеры
Следующий пример подключается к удаленному компьютеру и отображает сведения об операционной системе на удаленном компьютере. Создается ConnectionOptions для подключения к удаленному компьютеру с требуемыми параметрами подключения.
using System;
using System.Management;
public class RemoteConnect
{
public static void Main()
{
// Build an options object for the remote connection
// if you plan to connect to the remote
// computer with a different user name
// and password than the one you are currently using.
// This example uses the default values.
ConnectionOptions options =
new ConnectionOptions();
options.Authority = "ntlmdomain:DOMAIN";
// Make a connection to a remote computer.
// Replace the "FullComputerName" section of the
// string "\\\\FullComputerName\\root\\cimv2" with
// the full computer name or IP address of the
// remote computer.
ManagementScope scope =
new ManagementScope(
"\\\\FullComputerName\\root\\cimv2", options);
scope.Connect();
//Query system for Operating System information
ObjectQuery query = new ObjectQuery(
"SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope,query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach ( ManagementObject m in queryCollection)
{
// Display the remote computer information
Console.WriteLine("Computer Name : {0}",
m["csname"]);
Console.WriteLine("Windows Directory : {0}",
m["WindowsDirectory"]);
Console.WriteLine("Operating System: {0}",
m["Caption"]);
Console.WriteLine("Version: {0}", m["Version"]);
Console.WriteLine("Manufacturer : {0}",
m["Manufacturer"]);
}
}
}
Imports System.Management
Public Class RemoteConnect
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
' Build an options object for the remote connection
' if you plan to connect to the remote
' computer with a different user name
' and password than the one you are currently using
Dim options As ConnectionOptions
options = New ConnectionOptions
options.Authority = "ntlmdomain:DOMAIN"
' Make a connection to a remote computer.
' Replace the "FullComputerName" section of the
' string "\\FullComputerName\root\cimv2" with
' the full computer name or IP address of the
' remote computer.
Dim scope As ManagementScope
scope = New ManagementScope( _
"\\FullComputerName\root\cimv2", options)
scope.Connect()
' Query system for Operating System information
Dim query As ObjectQuery
query = New ObjectQuery( _
"SELECT * FROM Win32_OperatingSystem")
Dim searcher As ManagementObjectSearcher
searcher = _
New ManagementObjectSearcher(scope, query)
Dim queryCollection As ManagementObjectCollection
queryCollection = searcher.Get()
Dim m As ManagementObject
For Each m In queryCollection
' Display the remote computer information
Console.WriteLine("Computer Name : {0}", _
m("csname"))
Console.WriteLine("Windows Directory : {0}", _
m("WindowsDirectory"))
Console.WriteLine("Operating System: {0}", _
m("Caption"))
Console.WriteLine("Version: {0}", m("Version"))
Console.WriteLine("Manufacturer : {0}", _
m("Manufacturer"))
Next
Return 0
End Function
End Class
Комментарии
Свойство должно быть передано следующим образом: если оно начинается со строки "Kerberos:", проверка подлинности Kerberos будет использоваться, и это свойство должно содержать имя субъекта Kerberos. Например,
Kerberos:<principal name>
Если значение свойства начинается со строки "NTLMDOMAIN:", будет использоваться проверка подлинности NTLM, а свойство должно содержать доменное имя NTLM. Например,
NTLMDOMAIN:<domain name>
Если свойство равно NULL, будет использоваться проверка подлинности NTLM, а домен NTLM текущего пользователя будет использоваться.
Значение свойства
Если не null, это свойство может содержать имя домена Windows NT/Windows 2000, в котором необходимо получить пользователя для проверки подлинности.
Безопасность .NET Framework
Полное доверие для немедленного вызывающего абонента. Этот элемент не может использоваться частично доверенным кодом. Дополнительные сведения см. в разделе "Использование библиотек из частично доверенного кода".