Announcement

Collapse
No announcement yet.

Commandline restart in W2k?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Commandline restart in W2k?

    In W9x it's posible to restart or shutdown from the commandline but theose comands dont work in w2k (by obvious reasons).


    Does any one know how to do this?

    [This message has been edited by Technoid (edited 24 January 2001).]
    If there's artificial intelligence, there's bound to be some artificial stupidity.

    Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

  • #2
    There is a shutdown tool in the resource kit

    Grtz,

    Ed

    Comment


    • #3
      Well.. i can't find it..

      Please specifie more precise thanks!
      If there's artificial intelligence, there's bound to be some artificial stupidity.

      Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

      Comment


      • #4
        Well it's cryptically named...shutdown.exe!

        It's not big so if you don't have the resource kit cd I could mail or icq it to you

        Grtz,

        Ed

        Comment


        • #5
          I thought you meant the resource kit on the w2k cd!

          Anyway a found a program that does what i want!

          Thank you so much anyway!
          If there's artificial intelligence, there's bound to be some artificial stupidity.

          Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

          Comment


          • #6
            NT (and thus Win2k) requires you to have acquired the shutdown privilege before you could execute the ExitWindws[Ex] calls.

            for example,

            HANDLE hToken;
            TOKEN_PRIVILEGES tp;

            if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) && LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tp.Privileges[0].Luid)) {
            tp.PrivilegeCount = 1; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
            if (AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL
            , 0))
            ExitWindowsEx(EWX_SHUTDOWN, 0)
            }


            There is also EWX_REBOOT, EWX_POWEROFF or EWX_LOGOFF.. Just look them up in MSDN.

            Comment


            • #7
              Thanks for all great info and such.

              The reason i hunted for this info was because of a Demo machine we have at work.

              It's an Athlon classic 900Mhz with 128MB running W2K.

              After Fixing multiple heat problems (the HS the reseller recomended was a POS) OS bugs, 3dMark200 still wouldent work longer than 1,5 - 2,5 hour

              So i thought i could use "Yeat another BUG" that makes W2K think that the computer is inactive even when 3Dmark2000 is running to start a program or command that restarts the computer.

              Theory:
              Computer boots,
              3Dmark2K starts from Autostart folder,
              W2k counts down 60 min of inactivity and execute a command or a program that reboots the computer,
              24 around the clock operation!

              Reality:
              The computer BSOD's with the program i found.
              It works when i execute it manualy but seems to dump when executed at the same thime 3Dmark2K is running

              What's going to happen on monday:

              HDD eraze and Win98Se install.

              Thats not because of above described problems but more because we are trying to get ridh of the system by selling it cheap and W2K is not cheap!

              The only reason we have that system for sale is because of a ASUS AK72 POS Mainboard and a "Out of Buiznis" IDIOT that thought that 280 watt was enough to power said Mainboard, above mentioned CPU, 2! HDD's, DVD and Burner.

              fds thanks for the programming info.

              5-6 years ago I could actualy code DOS programs with C++ but that was a long time ago and both Borland and Microsofts C++ programs for coding C++ on win32 platforms makes my head spinn! (should probably buy a thick book on the subject and plow my way through it BUT it's amazing how much fun you can have with Dos batch scripts )
              If there's artificial intelligence, there's bound to be some artificial stupidity.

              Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

              Comment


              • #8
                I don't think he was interested in writing his own tool

                And offcourse you need enough rights on the target machine to use a shutdown

                Comment


                • #9
                  What you could have done is run shutdown.exe with the option to reboot and close all programs several times a day, using the task scheduler.

                  <Off topic>

                  You can have even more fun with the extended shell from win NT/2000. Saved me huge amounts off time at work. Tip: also have a look at wsh, just a little more diffult, but a step closer to real windows programming

                  </off topic>

                  Grtz,
                  Ed

                  Comment


                  • #10
                    EdSki

                    I should have been more acurate when i sad that i had found a program:

                    I couldent find "shutdown.exe" in the reskit on the W2K-CD wich i thought was the one you refered to.

                    The program i did found worked with taskscheduler but not while 3DMark2K was running.

                    And yes i would be a very happy idiot if you would e-mail me the "shutdown.exe" file you got.

                    WSH is kind of om my hate list since all of those E-mailviruses BUT I will look into it!

                    Thanks!!
                    If there's artificial intelligence, there's bound to be some artificial stupidity.

                    Jeremy Clarkson "806 brake horsepower..and that on that limp wrist faerie liquid the Americans call petrol, if you run it on the more explosive jungle juice we have in Europe you'd be getting 850 brake horsepower..."

                    Comment

                    Working...
                    X