📄 listusers.cs
字号:
// \\\|///
// \\ //
// ( @.@ )
//+----------------------oOOo-----(_)-----oOOo------------------------+
//| |
//| Created by stg609 |
//| |
//| 本人博客:http://stg609.cnblogs.com |
//| 由于水平有限,所写代码若有不足,欢迎大家到我博客交流 |
//| |
//| 注:转载请保留此信息 |
//| |
//| Copyright (C) 2008 stg609 |
//| All rights reserved |
//| |
//+-------------------+-ooO------------------Ooo-+--------------------+
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Diagnostics;
using System.Collections;
using System.DirectoryServices;
using System.Threading;
namespace MatureVoice
{
class ListUsers
{
public static ArrayList GetComputerList()
{
ArrayList list = new ArrayList();
DirectoryEntry root = new DirectoryEntry("WinNT:");
DirectoryEntries domains = root.Children;
domains.SchemaFilter.Add("domain");
foreach (DirectoryEntry domain in domains)
{
DirectoryEntries computers = domain.Children;
computers.SchemaFilter.Add("computer");
foreach (DirectoryEntry computer in computers)
{
object[] arr = new string[3];
IPHostEntry iphe = null;
try
{
iphe = Dns.GetHostByName(computer.Name);
}
catch
{
continue;
}
arr[0] = domain.Name;
arr[1] = computer.Name;
if (iphe != null && iphe.AddressList.Length > 0)
{
arr[2] += iphe.AddressList[0].ToString();
}
else
arr[2] = "";
list.Add(arr);
}
}
return list;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -