TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to Run Commands as Administrator

    General Discussion
    administrator
    2
    3
    2.2k
    Loading More Posts
    • 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.
    • ?
      A Former User
      last edited by A Former User

      Hey Guys -

      Just found this utility today and playing with it with my existing automation setup. Quick question, though. The first thing I tried to do is to have the ability to start / stop Windows (10) services using "net start service). When testing, it failed to start the service yet know the command is correct. Pretty sure it's because the execution requires elevation. What can I do (if anything) to achieve this?

      I've already installed the background service and when looking in the forum for an answer, saw the example of using "sc start service" therefore tried it instead, but it didn't work either. The system is Windows 10 x64 with UAC disabled and I obviously have full admin rights.

      Thanks!

      ? 1 Reply Last reply Reply Quote 0
      • ?
        A Former User @A Former User
        last edited by

        OK, I tried a few things and found the below workaround using a utility I use with CPAU. It works, but if there's a better way; please let me know. 🙂

        Basically, I copied Elevate.exe (had already downloaded) to Windows\System32 only because it was already in my path. Instead of executing "sc start service", I used "elevate sc start service". I tested it in a non-elevated command prompt first which worked so tried as a trigger and it worked!

        Thanks

        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @A Former User
          last edited by Russ

          @bzowk ,

          That should have worked. Background commands are elevated commands by default because they run in the context of the Windows service that runs as Local System.

          I have a background command called "Restart Print Spooler" that runs:

          sc stop spooler & sc start spooler
          

          I just tested it on my Win10 box and it worked. I have UAC turned on though, so maybe that's the difference.

          EDIT 7/4/21:
          Check out this solution too: https://www.triggercmd.com/forum/topic/1453/questions/2

          Russell VanderMey

          1 Reply Last reply Reply Quote 0
          • First post
            Last post