Environment.UserDomainName プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)



UserDomainName プロパティでは、まず、現在のユーザーについて、Windows NT 4.0 アカウント名のドメイン名部分を取得できるかが試みられます。アカウント名は、"ドメイン名 + '\' 文字 + ユーザー名" の形式になっています。この処理に失敗した場合、UserName プロパティのユーザー名に関連付けられたドメイン名を取得できるかどうかが試みられます。ホスト コンピュータがドメインに参加していないことが理由でこれに失敗した場合、ホスト コンピュータの名前が返されます。
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition プラットフォームメモ : このプラットフォームでは、UserDomainName はサポートされていません。

コード例を実行しているコンピュータのユーザー ドメイン名を表示するコード例を次に示します。(コード例の出力結果は、セキュリティ上の理由により、ユーザー ドメイン名を省略して記載しています。)
' Sample for the Environment.UserDomainName property Imports System Class Sample Public Shared Sub Main() Console.WriteLine() ' <-- Keep this information secure! --> Console.WriteLine("UserDomainName: {0}", Environment.UserDomainName) End Sub 'Main End Class 'Sample ' 'This example produces the following results: '(Any result that is lengthy, specific to the machine on which this sample was tested, 'or reveals information that should remain secure, has been omitted 'and marked "!---OMITTED---!".) ' 'UserDomainName: !---OMITTED---! '
// Sample for the Environment.UserDomainName property using System; class Sample { public static void Main() { Console.WriteLine(); // <-- Keep this information secure! --> Console.WriteLine("UserDomainName: {0}", Environment.UserDomainName); } } /* This example produces the following results: (Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked "!---OMITTED---!".) UserDomainName: !---OMITTED---! */
// Sample for the Environment::UserDomainName property using namespace System; int main() { Console::WriteLine(); // <-- Keep this information secure! --> Console::WriteLine( "UserDomainName: {0}", Environment::UserDomainName ); } /* This example produces the following results: (Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) UserDomainName: !---OMITTED---! */
// Sample for the Environment.UserDomainName property import System.*; class Sample { public static void main(String[] args) { Console.WriteLine(); // <-- Keep this information secure! --> Console.WriteLine("UserDomainName: {0}", Environment.get_UserDomainName()); } //main } //Sample /* This example produces the following results: (Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked "!---OMITTED---!".) UserDomainName: !---OMITTED---! */


Windows 98, Windows 2000 SP4, Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEnvironment.UserDomainName プロパティを検索する場合は、下記のリンクをクリックしてください。

- Environment.UserDomainName プロパティのページへのリンク