- using System.Management;
- public static void ShutDownComputer()
- {
- ManagementBaseObject outParam = null;
- ManagementClass sysOS = new ManagementClass("Win32_OperatingSystem");
- sysOS.Get();
- sysOS.Scope.Options.EnablePrivileges = true;
- ManagementBaseObject inParam = sysOS.GetMethodParameters("Win32Shutdown");
- inParam["Flags"] = "1";
- inParam["Reserved"] = "0";
- foreach (ManagementObject manObj in sysOS.GetInstances())
- {
- outParam = manObj.InvokeMethod("Win32Shutdown", inParam, null);
- }
- }
Sunday, January 30, 2011
ShutDown System By programming in asp.net
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment