Operating Sys Source Code
Operating Sys Source Code
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Management;
namespace operating_sys
{
class Program
{
public static void Main()
{
ConnectionOptions connection = new ConnectionOptions();
connection.Username = "kushi";
connection.Password = "kushi888";
connection.Authority = "ntlmdomain:DOMAIN";
ManagementScope ms = new ManagementScope("\\\\KUSHI-PC\\root\\CIMV2",
connection);
ms.Connect();
System.Management.SelectQuery sq = new System.Management.SelectQuery("SELECT *
FROM Win32_OperatingSystem");
System.Management.ManagementObjectSearcher mos = new
System.Management.ManagementObjectSearcher(ms, sq);
foreach (System.Management.ManagementObject m in mos.Get())
{
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"]);
Console.WriteLine("Free Physical Memory : {0}",
m["FreePhysicalMemory"]);
Console.WriteLine("Free Virual Memory : {0}",
m["FreeVirtualMemory"]);
Console.WriteLine("Total Virtual Memory Size : {0}",
m["TotalVirtualMemorySize"]);
Console.WriteLine("Total Visible Memory Size : {0}",
m["TotalVisibleMemorySize"]);
Console.WriteLine("Free Physical Memory : {0}",
m["FreePhysicalMemory"]);