获取服务器访问信息
本文关键字:信息 访问 服务器 获取 | 更新日期: 2023-09-27 18:29:55
如何获取服务器正在连接到网络的信息?
如果已连接,那么谁将获得访问权限(获得访问系统的权限)
谢谢,
普拉萨德
此类信息可以通过WMI 找到
例如,看看这个。这得到了RAM和C驱动器的信息,以及处理器工作的百分比。
DriveInfo[] drives = DriveInfo.GetDrives();
DriveInfo mainDrive = null;
foreach (DriveInfo drive in drives)
{
if (drive.IsReady && drive.Name.ToLower().Equals("c:''"))
{
mainDrive = drive;
break;
}
}
int totalRamSize = 0;
int freeRamSize = 0;
ManagementObjectSearcher ramSizeFinder = new ManagementObjectSearcher("Select * From Win32_OperatingSystem");
foreach (ManagementObject obj in ramSizeFinder.Get())
{
totalRamSize = Convert.ToInt32(obj["TotalVisibleMemorySize"]);
freeRamSize = Convert.ToInt32(obj["FreePhysicalMemory"]);
}
//PerformanceCounter cpuUsage=new PerformanceCounter("Processor","% Processor Time", "_Total");
int cpuUsage=0;
ManagementObjectSearcher cpuPercentFinder = new ManagementObjectSearcher("Select * From Win32_Processor");
foreach (ManagementObject obj in cpuPercentFinder.Get())
{
cpuUsage = Convert.ToInt32(obj["LoadPercentage"]);
}
很可能可以使用WMI(windows管理工具)检索信息