如何获取服务器连接到网络的信息?
如果已连接,那么谁将获得访问权限(获得访问系统的权限)
谢谢,
普拉萨德
答案 0 :(得分:2)
可以使用WMI
找到此类信息答案 1 :(得分:1)
例如看看这个。这获得了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"]);
}
答案 2 :(得分:0)
最有可能使用WMI(Windows管理工具)
来检索信息