Questions

Batch file with admin privileges

+
0 Votes
Locked

Batch file with admin privileges

Racin627
I need to run a batch file on about 600 computers during logon. User have only USER permissions. This batch file requires administrative privileges to run. I created a GPO with the assumption that running it from a logon script would supply the appropriate permissions but it fails due to lack of credentials. Does anyone have a script/batch file that I can add the credentials and this file run silently.
  • +
    0 Votes
    Why Me Worry?

    lookup the syntax of the runas command to see how to run it as the local administrator on the workstations

    this will fix the problem by running the script under the context of the local admin, allowing full access to the system files and registry

    +
    0 Votes
    Racin627

    Is there a way to embed the password into to batch file, there is over 600 computers and I need this to run silently without any unser interaction. I have not been suscessful creating one that did not require a password to be keyed in on every install.

    +
    0 Votes
    Why Me Worry?

    I don't think there is any way to mask the password through the runas command based on the switched available

    You may have no choice but to resort to VBS scripting if you need to prevent the password from being exposed

    +
    0 Votes
    Racin627

    That is what I have found out, unfortunately I don't have time or expertise to write a vb script quickly with this embedded password.

    +
    0 Votes
    bergmanc

    You can use Sanur. Its a command-line utility that will pass the credentials to the runas statement. Google "sanur" and you will find a lot about it.

    I just realized sanur is runas backwards =)

    -Corey

    +
    0 Votes
    Aakash Shah

    You can create a scheduled task and then run that scheduled task from the user account. The scheduled task would run using an admin account. You can use the new Group Policy Preferences to deploy this scheduled task. Also, note that by default, the scheduled task is viewable to admins only. So, you need to add read/write permissions on the scheduled task. This can be accomplished by using the cacls.exe tool. Good luck!

  • +
    0 Votes
    Why Me Worry?

    lookup the syntax of the runas command to see how to run it as the local administrator on the workstations

    this will fix the problem by running the script under the context of the local admin, allowing full access to the system files and registry

    +
    0 Votes
    Racin627

    Is there a way to embed the password into to batch file, there is over 600 computers and I need this to run silently without any unser interaction. I have not been suscessful creating one that did not require a password to be keyed in on every install.

    +
    0 Votes
    Why Me Worry?

    I don't think there is any way to mask the password through the runas command based on the switched available

    You may have no choice but to resort to VBS scripting if you need to prevent the password from being exposed

    +
    0 Votes
    Racin627

    That is what I have found out, unfortunately I don't have time or expertise to write a vb script quickly with this embedded password.

    +
    0 Votes
    bergmanc

    You can use Sanur. Its a command-line utility that will pass the credentials to the runas statement. Google "sanur" and you will find a lot about it.

    I just realized sanur is runas backwards =)

    -Corey

    +
    0 Votes
    Aakash Shah

    You can create a scheduled task and then run that scheduled task from the user account. The scheduled task would run using an admin account. You can use the new Group Policy Preferences to deploy this scheduled task. Also, note that by default, the scheduled task is viewable to admins only. So, you need to add read/write permissions on the scheduled task. This can be accomplished by using the cacls.exe tool. Good luck!