1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

have non-admin execute script that repairs network connection

Discussion in 'Tech Support' started by OneSeventeen, 7 Nov 2007.

  1. OneSeventeen

    OneSeventeen Oooh Shiny!

    Joined:
    3 Apr 2002
    Posts:
    3,454
    Likes Received:
    2
    I wrote a batch file to execute all the commands that repairing a network normally executes:
    Code:
    ipconfig /renew
    arp -d *
    nbtstat -R
    nbtstat -RR
    ipconfig /flushdns
    ipconfig /registerdns
    I would like a non-admin to be able to execute this script.
    Is there a way to configure the command so it runs with admin rights, without storing an admin username and password in clear text, or possibly give a specific user rights to those commands contained in the script?
     
  2. Shadow_101

    Shadow_101 Minimodder

    Joined:
    12 Feb 2004
    Posts:
    1,115
    Likes Received:
    5
    Need to run it as system, used to do it at uni to get 'things' to run on a locked down pc. When you schedule a task (e.g. cmd.exe) on windows it runs as system, no matter what account you’re logged into. voids the need for admin rights.
     
  3. OneSeventeen

    OneSeventeen Oooh Shiny!

    Joined:
    3 Apr 2002
    Posts:
    3,454
    Likes Received:
    2
    Does that mean I'd have to schedule a time for it to run, or could I make a shortcut to execute the scheduled task?
    (I want this to run each time the person executes the VPN client, and they should only execute that once every week or so.)
     
  4. Shadow_101

    Shadow_101 Minimodder

    Joined:
    12 Feb 2004
    Posts:
    1,115
    Likes Received:
    5
    Don’t really know much about batch files, but all you'd need to do is catch the current system time, append 2 seconds to it then have it execute
    "at [Time] batchfile.bat"

    Put /interactive if you want the user to see it.

    I don’t know you can catch the system time with batch files, but that’s the way I’d try and do it. There might be a simpler solution

    edit: maybe use %time%, then some how append 2 seconds
     
    Last edited: 8 Nov 2007
  5. Shadow_101

    Shadow_101 Minimodder

    Joined:
    12 Feb 2004
    Posts:
    1,115
    Likes Received:
    5
    bleh sorry to double post, i got board in work decided to look this up a bit more

    A better way seems this

    sc delete testsvc
    sc create testsvc binpath= "cmd /K start" type= own type= interact
    sc start testsvc

    I’m pretty sure you can place your batch file in place of cmd and it will execute as system, with out having to mess with system scheduler

    Source
     
  6. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,374
    Likes Received:
    241
    at command requires admin privileges to run, due to you being able to use it as a privilege escalation (to system) hack.

    Fascinating stuff, opening a cmd.exe window with at, then killing explorer, and relaunching it through the system account.
     
  7. cyrilthefish

    cyrilthefish What's a Dremel?

    Joined:
    15 Apr 2004
    Posts:
    1,362
    Likes Received:
    99
    i think i've corrupted the security at work more than a few times now by fixing stuff on users accounts by manually creating a 'CMD' shortcut via remote desktop / SMS on their desktops to bypass the run command lockout ^_^
     
Tags:

Share This Page