?
Solved

VB Translation of PSSHUTDOWN.EXE

Posted on 2006-11-08
8
Medium Priority
?
1,987 Views
Last Modified: 2008-01-09
Hello Experts!

Does anybody know of a VB translation of Mark Russinovich's PSSHUTDOWN.EXE program?

I want to incorporate this program's functionality into my own VB application.  I've found the VB translation of his another utility program PSLOGGEDON.EXE at http://www.mvps.org/access/api/api0062.htm, in which the original source code (in C/C++) was available for download from www.sysinternals.com.  So, I'm wondering if the aforementioned program (written in C/C++) has been translated into VB.

In short, I want my VB app to do exactly the same thing.  That is, be able to support all following 4 types of operation on a remote machine:

 1. Logoff
 2. Shutdown
 3. Reboot
 4. Poweroff

I already knew and have tried both following Win32 APIs:

 1. ExitWindowsEx - this supports all 4 above types of operation, except that it ONLY apples to the LOCAL machine.
 2. InitiateSystemShutdownEx - this seems to be the one I wanted, except that it DOES NOT have or support the "logoff" method.

I could include the PSSHUTDOWN.EXE and create a MSI installation package to be distributed along with my compiled app so that I can use the "shell" function, but I just want my app to be a pure, stand-alone application.

Any help would be greatly appreciated.
0
Comment
Question by:jkaios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 17902944
0
 
LVL 12

Author Comment

by:jkaios
ID: 17903400
Thanks gecko.  That uses the InitiateSystemShutdown API, which DOES NOT support the "Logoff" operation.

In fact, somebody (shijusn) already provided this link to my previous question at: http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_22038122.html
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 17913658
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:gecko_au2003
ID: 17916127
I did mention wmi above but I havent had much of a chance lately to have a look around for examples on how to remotely restart, shutdown, log off etc using wmi but will have a look tommorow , so if that wmiRescue zip does not help then post back and I will post back with some wmi examples :)
0
 
LVL 12

Author Comment

by:jkaios
ID: 17926667
Thanks EDDYKT, but what I preferred was to use API instead due to the fact that when using the WMI's "Win32Shutdown" method of the "Win32_OperatingSystem" class on Windows XP Service Pack 2, it really slows down the process, and most of the time fails when the Firewall is turned on.

In fact, I've already developed a fully functional app (using WMI) that does this, but the problem started when Windows XP SP2 was released.  Until now it still works, however, it is REALLY slow as a result of the heavy security in XP SP2.  Note that this problem does not apply to W2K machines.

The reason why I wanted a translation of the PSSHUTDOWN.EXE is because it bypasses those XP security.  The built-in utility (Shutdown.exe) that came with XP and Server 2003 is great, except that it does not support the "logoff" method.

I've been wondering what sort of or combination of API's did Mark Russinovich use in his wonderful PSSHUTDOWN.EXE program?
0
 
LVL 12

Author Comment

by:jkaios
ID: 18120643
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.

Therefore, I 'm gonna ask the Moderator to close this question.
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 18193183
Closed, 500 points refunded.
PashaMod
Community Support Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question