Link to home
Start Free TrialLog in
Avatar of jkaios
jkaiosFlag for Marshall Islands

asked on

Remote LOGOFF without using WMI

Hello Experts!

I was wondering if any of you happen to know an API function to log off a remote machine.  I DON'T want to use the Win32Shutdown WMI class method as I've already used it, which is really slow and mostly seem to fail on Windows XP machines when Firewall is turned on.

Please note that I already know about the following API's but they are still limited:

  ExitWindowsEx - supports the logoff method, but only on a local machine.
  InitiateSystemShutdown - works on remote machines, but only provides shutdown and restart.  It DOES NOT have a param or flag for LogOff.

Any help would be greatly appreciated.
Avatar of Zak-R
Zak-R


I don't know that much about this kind of things...
but, are you trying to do this in one of you remote computers?
have you tried a client and the server for this kind of methode?

[(--)] ===> [o] <==
                             ||
                             ||
                             ===========> [   ] + m8

Oops!
Sorry

:-)



Avatar of jkaios

ASKER

That would be my last resort.  But I just want to implement a pure, stand-alone app that would do the trick, such as the PSSHUTDOWN.EXE by Mark that amazingly supports such feature.

I wonder what sort of APIs he used.
Avatar of jkaios

ASKER

navstar16,

Thanks for the links, but I'm looking for something to "LOGOFF" a REMOTE machine, not shutdown.
I'm looking for some sort of APIs and NOT the WMI stuff as I've described in above when I posted the question.

Also, am looking for something I can incorporate into my app (preferably code), not any kind of external utilities.
Avatar of Ark
If you don't want use PSSHUTDOWN.EXE, you can use PsExec.exe + %winsysdir%\logoff.exe :)
Avatar of jkaios

ASKER

Ark,

Thanks for your comment, but let me re-clarify my intention:

I'm looking for something (preferably API's) that I can incorporate into my app, and NOT any kind of external utilities.
I wan to implement a pure, stand-alone app that would do the trick so I can add other customization to it.
ASKER CERTIFIED SOLUTION
Avatar of jwarnken
jwarnken
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkaios

ASKER

I just found out the trick that PSSHUTDOWN.EXE uses is that it quietly copies a file named PSSDNSVC.EXE to the hidden ADMIN$ share on the target machine (either in "C:\Windows" or "C:\WinNT" depending on target machine's OS).

This file is then installed on the target machine as a service, and clearly, runs as a client/server application.  After the requested action has been performed on the target machine, then calling program (PSSHUTDOWN.EXE) then deletes PSSDNSVC.EXE from the target machine.  The Event Viewer shows all the traces when this service was installed and removed.

I thought there were some other fancy (undocumented) API's that support remote logoff other than the InititateSystemShutdown.  Perhaps, Mark could be using a different technique other than what I assumed, who knows.  The guy is a genius and he even has a very good article on Win32 APIs versus Native APIs.

Anyways, I think I'm gonna award the points to jwarnken for instigating the idea of "client/server" stuff.