[RESOLVED] Batch file question
Results 1 to 4 of 4

Thread: [RESOLVED] Batch file question

  1. #1
    Join Date
    Jun 2001
    Posts
    448

    Resolved [RESOLVED] Batch file question

    I'm not sure if this post should go in this thread so feel free to move it if it belongs somewhere else.

    We're running a Windows network on a mixed Windows 2000/2003 domain. We use simple batch files as login scripts for all of the user's. We have a situation where, through one of these batch files, we'd like to create a new directory on each PC's hard drive, copy files into that directory from a fileserver location, and than copy another single file to the All Users desktop folder and have it overwrite an existing file located there with the same name.

    We'd like to do all of this through a batch file so I'm wondering if there is a way to run a batch file as another user, if that makes sense. Is there some way to run a script as a domain admin, even if you are a regular user? Perhaps calling another script and having a runas command in there or something?

    Let me know what you think. Thanks. Oh yeah, and let's try and stick with simple batch files...

  2. #2
    Join Date
    Feb 2000
    Location
    Idaho Falls, Idaho, USA
    Posts
    18,429
    You can use the runas command to run a batch file as an administrator. However, because the request for the password is interactive, you can't use runas in a batch file script. There are utilities to address this however.

    Links:

    http://labmice.techtarget.com/window...tion/runas.htm
    http://support.microsoft.com/?kbid=301634

    http://www.windowsnetworking.com/kba...WindowsXP.html
    Runas is not scriptable because pw has to be entered interactively. There are utilities to allow runas to be scripted.

    CPAU Runas alternative supporting encoded passwords.
    http://www.joeware.net/win/free/tools/cpau.htm

    LSrunas/LSRunase Console based Runas alternatives, the latter supports encoded passwords.
    http://www.lansweeper.com/ls/lsrunasold.aspx

    AutoIt (v3) Scripting language for automating the Windows GUI.
    http://www.hiddensoft.com/

    RunAsSpc
    http://robotronic.de/runasspcEn.html

  3. #3
    Join Date
    Apr 2007
    Location
    Clearwater, Florida
    Posts
    837
    What kind of error message are you getting. Is it just with the All Users folder?

    IIRC I used a single logon script back in the mid-90's to do the very same thing except the All Users folder. I did not need any special permissions to accomplish the task.

  4. #4
    Join Date
    Jun 2001
    Posts
    448

    Talking [resolved]

    Thanks for the ideas, guys. Here's what I ended up doing.

    I used the cpau program to run the commands needed with admin privileges and it worked great. I was able to create the necessary directory structure, copy the files there, and delete some files from the All Users desktop folder and copy a new file there.

    It worked great.
    Last edited by mcseguy9; August 3rd, 2007 at 10:13 AM. Reason: [RESOLVED]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •