Remote reboot command - STOP

Corporate network.  They use programs to push updates to our desktops (Mirimba? or something)
Some updates need a reboot.

Any way I can stop the remote command to reboot?  Registry change?  Windows API?  These "updates" usually occur at night when I am absent.

I have critical scripts running and need to stop the reboot.  I.T. has not been helpful in this situation.

Thanks.  (Where does a question of this type belong?)  I have a background in VB so I asked it here.

Need a long term answer.  If the solution is something I need to do daily, then some type of script I can write and run with the task scheduler.
mayfieldjrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark_FreeSoftwareCommented:

have you ever been at your computer when it reboots,

if yes, does it display some screen like rebooting in 30 seconds?


then try this:

type in dos (or the runbox) "shutdown -a" (without quotes)




if it stops your pc, try creating a program that looks for the shutdown window, and than executes the shutdown -a command
0
nffvrxqgrcfqvvcCommented:
Yes this is possible to do in VB, What you need to do is setup a callback and wait for WM_QUERYENDSESSION message. This message is sent to all applications before the system is about to shutdown. This gives your applications a chance to either allow the shutdown or bypass the shutdown. What you must do is return False for the WindowProc in order to not allow the system to shutdown.

WM_QUERYENDSESSION
http://msdn.microsoft.com/library/en-us/shutdown/base/wm_queryendsession.asp
0
nffvrxqgrcfqvvcCommented:
Note: Just be aware that the above might not be full proof depending on how the update application is shutting down the computer.
http://msdn.microsoft.com/library/en-us/shutdown/base/logging_off.asp
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mayfieldjrAuthor Commented:
I am not familiar with setting up callbacks.  Caould I get an example please?

I am guessing I can just create a standard EXE with a blank form that is somehow always checking for the WM_QUERYENDSESSION message.  When I get it the I have the program return 0??

Thanks
0
nffvrxqgrcfqvvcCommented:
You could try the below example I whiped up it should work...

'Create new standard exe project
'Add 1 listbox to form
'Add 1 Module.bas

' Compile the application, then run the application and try to shutdown windows. It should abort the shutdown.


'---- Module1.bas ----


Option Explicit

    Private Declare Function SetWindowLongA Lib "user32" ( _
        ByVal hwnd As Long, ByVal nIndex As Long, _
        ByVal dwNewLong As Long) As Long
   
    Private Declare Function CallWindowProcA Lib "user32" ( _
        ByVal lpPrevWndFunc As Long, _
        ByVal hwnd As Long, ByVal Msg As Long, _
        ByVal wParam As Long, ByVal lParam As Long) As Long
   
    Private Const GWL_WNDPROC = (-4)
   
    Private Const WM_QUERYENDSESSION = &H11
    Private Const WM_ENDSESSION = &H16
   
    Dim ProcRet As Long
   
Public Sub BeginDetectingShutdown(ByVal hwnd As Long)
    ProcRet = SetWindowLongA(hwnd, GWL_WNDPROC, AddressOf CatchShutdown)
End Sub

Public Sub StopDetectingShutdown(ByVal hwnd As Long)
    Call SetWindowLongA(hwnd, GWL_WNDPROC, ProcRet)
End Sub

Public Function CatchShutdown( _
    ByVal hwnd As Long, _
    ByVal uMsg As Long, _
    ByVal wParam As Long, _
    ByVal lParam As Long) As Long
   
   Select Case uMsg
        Case WM_QUERYENDSESSION
            CatchShutdown = Abs(False)
                Form1.List1.AddItem "Windows attemted to shutdown " & Time
        Case WM_ENDSESSION
            CatchShutdown = Abs(False)
        Case Else
        CatchShutdown = CallWindowProcA(ProcRet, hwnd, uMsg, wParam, lParam)
   End Select
   
End Function








'--- Form1 ---

Option Explicit

Private Sub Form_Load()
    BeginDetectingShutdown Me.hwnd
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    StopDetectingShutdown Me.hwnd
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mayfieldjrAuthor Commented:
Perfect.  Wonderful.  Worked like a charm.  Excellent!!!

Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.