ConnectionOptions.Locale プロパティ

定義

接続操作に使用するロケールを取得または設定します。Gets or sets the locale to be used for the connection operation.

public:
 property System::String ^ Locale { System::String ^ get(); void set(System::String ^ value); };
public string Locale { get; set; }
member this.Locale : string with get, set
Public Property Locale As String

プロパティ値

WMI への接続でロケールに使用される String 値を返します。Returns a String value used for the locale in a connection to WMI.

次の例では、リモートコンピューターに接続し、リモートコンピューターのオペレーティングシステムに関する情報を表示します。The following example connects to a remote computer and displays information about the operating system on the remote computer. 必要ConnectionOptionsな接続オプションを使用してリモートコンピューターに接続するためのが作成されます。A ConnectionOptions is created to connect to the remote computer with the desired connection options.

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.Locale = "MS_409"; 
                 
        // 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.Locale = "MS_409"

        ' 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

注釈

Microsoft ロケール識別子の場合、文字列の形式は "MS_xxx" です。ここで、 Xxxはロケール id (LCID) を示す16進数形式の文字列です。たとえば、米国英語は "MS_409" と表示されます。For Microsoft locale identifiers, the format of the string is "MS_xxx", where xxx is a string in hexadecimal form that indicates the Locale Identification (LCID); for example, American English would appear as "MS_409".

プロパティ値Property Value

既定値は DEFAULTLOCALE です。The default value is DEFAULTLOCALE.

.NET Framework セキュリティ.NET Framework Security

直前の呼び出し元に対する完全な信頼。Full trust for the immediate caller. このメンバーは、部分的に信頼されているコードから使用することはできません。This member cannot be used by partially trusted code. 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。For more information, see Using Libraries from Partially Trusted Code.

適用対象