Running a Batch that needs administrator privileges...

Posted on 2006-05-16
Last Modified: 2012-06-27
Hello everyone,

I work in an IT department for a small company, our size is increasing, and doing things to each pc one by one takes a long time.
We implemented batch scripts to run on logon, but as all our users are not administrators, some of the code in the batch files do not execute. EG: Copying files, or executing programs such as setup programs for software.

My question is, how do I get around all this without granting our users administrator privileges?
I have searched on here, and one solution was to create a service, but in order to get the service running I would need to go to every machine to start the service.
If anyone comes up with a solution, detail would be helpful. Would like to avoid having to visit every machine though.

Any help is appreciated! Thanks.
Question by:Alan-Yeo
    LVL 43

    Accepted Solution

    Couple of suggestions: #

    1. If you have active directory use a startup script assigned to the computer's OU's rather to the users.

    2. Use an AT command scheduled on each box to run the command as SYSTEM

    3. Use RunAs.exe in your login script (not a good idea as password would show up in text file...)

    4. Again if you have AD to install apps. create group policy entries to install the software using MSI file stored on a share which you can assign to users or computers.

    5. Copy the files to each machine from your own domain admin account using a list of servers from the domain.

    If any of that sounds like what you want someone here can elaborate on specific scripts.

    LVL 24

    Expert Comment

    > , how do I get around all this without granting our users administrator privileges?

    one is, the admin gets footprint on each pc, their own ID and password, and this ID is then used for the install

    two is for use of scheduler, in dos of  'AT' command to start a .cmd  file to run, installing things. When the AT command runs, it has system privilege, which is more powerful than Administrator. That is one main reason I like to use scheduler. No one has to log in to get the authority, and you may not need to force users to log off.
    LVL 24

    Expert Comment

    I think that means I like dragon-it 's #2 and #5 best.
    LVL 5

    Expert Comment

    low-tech solution:... write a batch file that contains means for authorization (i.e. id and password) and then compile it:

    I've used this compiler with success in the past.

    LVL 23

    Expert Comment

    by:Mohammed Hamada
    From One of my previous posts..

    You will probably need to make a script file that will include both, username and password so they can't see them or get prompted to type them.. See the following link please..

    Or use the Runasp third party command line..

    The password parameter is not supported by the runas command on XP, but this runasp does support it..

    BTW: if you didn't find your answear in first link, then the command line runasp will do it..

    LVL 43

    Expert Comment

    by:Steve Knight

    Are you still there?  Did any of that help?


    Author Comment

    Very sorry for taking so long to get back to you,

    Many thanks for all your help/
    LVL 43

    Expert Comment

    by:Steve Knight
    No problem, glad if it helped.... got me past the 50k mark in the TA too :-)


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (…
    Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now