Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to beat around shutdown –a

how to beat around shutdown –a

Scheduled Pinned Locked Moved Visual Basic
helptutorial
14 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R RK11 2009

    Thanks Mithun, but i wanted to know if the forced shut down has been initiated, the user should not be able to stop this by using "shutdown –a" command. How to achieve this?

    M Offline
    M Offline
    Mithun Shitole
    wrote on last edited by
    #4

    RK, The link tells you about a function "ExitWindowsEx" Lib "User32" , If you set parameter to FORCE, I think it can not be stopped using shutdown -a. ( I have tried it once and failed as system gets shutdown quickly ) Also I have tried by creating a batch file as following:

    shutdown -f
    shutdown -a

    Still my system logged off. So i think ExitWindwsEx with FORCED parameter is function for you.

    Mithun Shitole "Free Your Mind" http://www.technoyaari.com

    R 1 Reply Last reply
    0
    • M Mithun Shitole

      RK, The link tells you about a function "ExitWindowsEx" Lib "User32" , If you set parameter to FORCE, I think it can not be stopped using shutdown -a. ( I have tried it once and failed as system gets shutdown quickly ) Also I have tried by creating a batch file as following:

      shutdown -f
      shutdown -a

      Still my system logged off. So i think ExitWindwsEx with FORCED parameter is function for you.

      Mithun Shitole "Free Your Mind" http://www.technoyaari.com

      R Offline
      R Offline
      RK11 2009
      wrote on last edited by
      #5

      I am using the InitiateSystemShutdown function and am forcing the shut down still a person with admin rights on the m/c is able to abort the shut down using shutdown -a command. so any help here.

      M 1 Reply Last reply
      0
      • R RK11 2009

        I am using the InitiateSystemShutdown function and am forcing the shut down still a person with admin rights on the m/c is able to abort the shut down using shutdown -a command. so any help here.

        M Offline
        M Offline
        Mithun Shitole
        wrote on last edited by
        #6

        Try setting the timeout parameter to 0.

        Mithun Shitole "Free Your Mind" http://www.technoyaari.com

        R 1 Reply Last reply
        0
        • M Mithun Shitole

          Try setting the timeout parameter to 0.

          Mithun Shitole "Free Your Mind" http://www.technoyaari.com

          R Offline
          R Offline
          RK11 2009
          wrote on last edited by
          #7

          No , we have to dispaly the message to user some 5 mins before so that he can save the changes, so we can not put the timeout parameter as 0.

          D 1 Reply Last reply
          0
          • R RK11 2009

            No , we have to dispaly the message to user some 5 mins before so that he can save the changes, so we can not put the timeout parameter as 0.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #8

            In that case, you have a few options, none of them in code. Remove the admin rights from the user Remove the shutdown.exe from the machine Add shutdown.exe to the list of forbidden executables using group policy

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            R 1 Reply Last reply
            0
            • D Dave Kreskowiak

              In that case, you have a few options, none of them in code. Remove the admin rights from the user Remove the shutdown.exe from the machine Add shutdown.exe to the list of forbidden executables using group policy

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              R Offline
              R Offline
              RK11 2009
              wrote on last edited by
              #9

              Hi Dave, Thanks for your reply but we can not implement the above suggestions as the some user need the admin rights on their m/c and also the exe file has to run on each individuals m/c so that it can shut their PC at a particular time. Any other suggestion then pls do let me know.

              L D 2 Replies Last reply
              0
              • R RK11 2009

                Hi Dave, Thanks for your reply but we can not implement the above suggestions as the some user need the admin rights on their m/c and also the exe file has to run on each individuals m/c so that it can shut their PC at a particular time. Any other suggestion then pls do let me know.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                Stupid suggestion but how about when you run your shutdown function rename shutdown.exe to shutdown.exe.bak or something so they can't run shutdown.exe with any parameters..

                Check out the CodeProject forum Guidelines[^]

                1 Reply Last reply
                0
                • R RK11 2009

                  Hi Dave, Thanks for your reply but we can not implement the above suggestions as the some user need the admin rights on their m/c and also the exe file has to run on each individuals m/c so that it can shut their PC at a particular time. Any other suggestion then pls do let me know.

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #11

                  Than you just ruled out every option you have to preventing the users from aborting the shutdown. You're only other option how is to threaten people with termination for violating company policy.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  M 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Than you just ruled out every option you have to preventing the users from aborting the shutdown. You're only other option how is to threaten people with termination for violating company policy.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    M Offline
                    M Offline
                    Mithun Shitole
                    wrote on last edited by
                    #12

                    Then I think you have to write your own daemon so that you can connect to it, n call a routine which will show a shutdown timer , and on time up call a forced shutdown with 0 time inerval. :)

                    Mithun Shitole "Free Your Mind" http://www.technoyaari.com

                    D 1 Reply Last reply
                    0
                    • M Mithun Shitole

                      Then I think you have to write your own daemon so that you can connect to it, n call a routine which will show a shutdown timer , and on time up call a forced shutdown with 0 time inerval. :)

                      Mithun Shitole "Free Your Mind" http://www.technoyaari.com

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #13

                      True. A little extreme for the problem at hand, but then again, they did themselves in with the poorly designed environment and policies. BTW: You may want to reply to the OP and not me. He's has no idea you posted this message because he didn't get the email that you posted to mine.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      M 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        True. A little extreme for the problem at hand, but then again, they did themselves in with the poorly designed environment and policies. BTW: You may want to reply to the OP and not me. He's has no idea you posted this message because he didn't get the email that you posted to mine.

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007, 2008

                        M Offline
                        M Offline
                        Mithun Shitole
                        wrote on last edited by
                        #14

                        Thanks Dave, I am new to cp and was unaware of this cool feature.

                        Mithun Shitole "Free Your Mind" http://www.technoyaari.com

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups