Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!



Batch file with admin privileges

By 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.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

You need to include the runas command in your script and run as local admin

by Why Me Worry? In reply to Batch file with admin pri ...

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

Collapse -

RunAs cmd

by Racin627 In reply to You need to include the r ...

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.

Collapse -

You wan't your cake and to eat it too

by Why Me Worry? In reply to RunAs cmd

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

Collapse -

RunAs cmd

by Racin627 In reply to You wan't your cake and t ...

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.

Collapse -


by bergmanc In reply to RunAs cmd

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 =)


Collapse -

Use Scheduled Task

by Aakash Shah In reply to You wan't your cake and t ...

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!

Related Discussions

Related Forums