Announcement

Collapse
No announcement yet.

Need to run remote batch file automatically as Administrator

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

  • Need to run remote batch file automatically as Administrator

    I just inherited a new job that is so bad the last company just walked out after a few days.
    I need to remotely do 20 things but I can't get to step one yet. I can't seem to get the syntax down. I want to put a simple batch file on the public share F: and run it as full administrator rights.
    .
    INSIDE OF THE DOMAIN LOGIN SCRIPT:
    Set oShell = WScript.CreateObject("WSCript.shell")
    oShell.run "f:\psexec \\* -u BW\administrator -p PaSSw0rd -c -F:\adddomainuser.bat"
    .
    THIS IS THE CONTENTS OF F:\adddomainuser.bat
    net localgroup administrators "BW\Domain Users" /add
    .
    .
    Thanks in advance.
    butch

  • #2
    Since you have AD, can't you use Restricted Groups in Group Policy to add to the local admins group?
    (Note it is NOT a good idea to make domain users into local admins unless there is a compelling business case)
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      This Q in Microsoft's forums suggests using psexec. However, the code logs the specified user onto the remote machine first and then runs the batch files. Turns out the batch files were running under a different account even though the OP, like you, had specified their own credentials.
      A recent poll suggests that 6 out of 7 dwarfs are not happy

      Comment


      • #4
        Nice one Blood!
        Cheers,

        Daniel Petri
        Microsoft Most Valuable Professional - Active Directory Directory Services
        MCSA/E, MCTS, MCITP, MCT

        Comment

        Working...
        X