Run as system and logoff user "USER"
-
Hi. I have a program that runs as a scheduled task. The program runs on XP as SYSTEM. The idea is that the program will run in the background, while USER is active. I need the program to logoff USER when specific conditions occur. I tried using
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);but that appears to not log USER off. I think maybe it's logging SYSTEM off, as it is running as SYSTEM. How can i logogg USER? Thanks, SummerBulb.
-
Hi. I have a program that runs as a scheduled task. The program runs on XP as SYSTEM. The idea is that the program will run in the background, while USER is active. I need the program to logoff USER when specific conditions occur. I tried using
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);but that appears to not log USER off. I think maybe it's logging SYSTEM off, as it is running as SYSTEM. How can i logogg USER? Thanks, SummerBulb.
This MSDN thread appears to link to a possible solution for you: how to force the interactive user to logoff.
"We are men of action; lies do not become us."
-
Hi. I have a program that runs as a scheduled task. The program runs on XP as SYSTEM. The idea is that the program will run in the background, while USER is active. I need the program to logoff USER when specific conditions occur. I tried using
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);but that appears to not log USER off. I think maybe it's logging SYSTEM off, as it is running as SYSTEM. How can i logogg USER? Thanks, SummerBulb.
You can also invoke shutdown.exe with the /l option. But I believe any logged on user gets a prompt saying that SYSTEM is trying to log off. I think is is so that any user can save his work prior to being logged off.
SG Aham Brahmasmi!