using System.Management;ÂÂ
public class Win32OperatingSystemÂÂ
{ÂÂ
public static void Shutdown(string machineName, string username, string password)ÂÂ
{ÂÂ
ManagementScope Scope = null;ÂÂ
ConnectionOptions ConnOptions = null;ÂÂ
ObjectQuery ObjQuery = null;ÂÂ
ManagementObjectSearcher ObjSearcher = null;ÂÂ
tryÂÂ
{ÂÂ
ConnOptions = new ConnectionOptions();ÂÂ
ConnOptions.Impersonation = ImpersonationLevel.Impersonate;ÂÂ
ConnOptions.EnablePrivileges = true;ÂÂ
//local machineÂÂ
if (machineName.ToUpper() == Environment.MachineName.ToUpper() )ÂÂ
Scope = new ManagementScope(@”\ROOT\CIMV2″, ConnOptions);ÂÂ
elseÂÂ
{ÂÂ
//remote machineÂÂ
ConnOptions.Username = username;ÂÂ
ConnOptions.Password = password;ÂÂ
Scope = new ManagementScope(@”\\” + machineName + @”\ROOT\CIMV2″, ConnOptions);ÂÂ
}ÂÂ
Scope.Connect();ÂÂ
ObjQuery = new ObjectQuery(“SELECT * FROM Win32_OperatingSystem”);ÂÂ
ObjSearcher = new ManagementObjectSearcher(Scope, ObjQuery );ÂÂ
foreach( ManagementObject operatingSystem in ObjSearcher.Get())ÂÂ
{ÂÂ
MessageBox.Show(“Caption = ” + operatingSystem.GetPropertyValue(“Caption”));ÂÂ
MessageBox.Show(“Version = ” + operatingSystem.GetPropertyValue(“Version”));ÂÂ
ManagementBaseObject outParams = operatingSystem.InvokeMethod (“Shutdown”,null,null);ÂÂ
}ÂÂ
}ÂÂ
catch (Exception ex)ÂÂ
{ÂÂ
throw ex;ÂÂ
}ÂÂ
}ÂÂ
}ÂÂ
//Note:ÂÂ
Call the function like:ÂÂ
[STAThread]ÂÂ
static void Main(string[] args)ÂÂ
{ÂÂ
Win32OperatingSystem.Shutdown(@”Machinename”, @”UserName”, @”Pwd”);ÂÂ
}

hey janith here.. what is this code for? why do u say remote machine?
You can shut down another computer on the network using this s code
thank you…