by Emanuel Dejanu [emanuel dot dejanu at humaninfo dot ro] posted on 2010/08/04 |
|
Hi,
I have used your class to EnableToken(\"SeShutdownPrivilege\") so that I can call InitiateSystemShutdown function.
Can you add a new function like this to your class:
public static bool RemoteShutdown(string machineName = null, string message = \"Need to shutdown\", int timeout = 0, bool forceAppsClosed = true)
{
WindowsController.EnableToken(\"SeShutdownPrivilege\");
if (string.IsNullOrEmpty(machineName))
machineName = Environment.MachineName;
return InitiateSystemShutdown(machineName, message, timeout, forceAppsClosed, false);
}
public static bool RemoteReboot(string machineName = null, string message = \"Need to reboot\", int timeout = 0, bool forceAppsClosed = true)
{
EnableToken(\"SeShutdownPrivilege\");
if (string.IsNullOrEmpty(machineName))
machineName = Environment.MachineName;
return InitiateSystemShutdown(machineName, message, timeout, forceAppsClosed, true);
}
Thanks,
Emanuel
|