A VBS that will copy a file from server to c:\windows\system32 on client's pc

Posted on 2004-11-25
Last Modified: 2010-05-02
Basically I want a command that will copy a file from a server to c:\windows\system32 on client's pc

There are 250+ pcs and I want to run a log in script from GPO.

I have asked this question a few weeks back but noone was able to help me with.  There was an issue with permission on c:\windows\system32 on local machine that prevented a file from being copied to.

Question by:cooljam23
    LVL 95

    Expert Comment

    by:Lee W, MVP
    What you're trying to do - must it be done with a login script?  Is the goal simply to put a file on the local PC for later use/reference?

    If so, I can suggest/write alternatives for this.

    Author Comment

    Ok  we're trying to put a wallpaper file (bmp) on to client's pc in c:\windows\system32 and then we can set the GPO to point to c:\windows\system32\file.bmp

    I don't know of any other way off copying the file from the server to c:\windows\system32 with the proper rights

    Log in batch file won't do this because of the permission issues.

    LVL 95

    Accepted Solution

    A DOS command (using a few other dos commands) should be able to do this:

    for /f "tokens=1" %a in ('net view ^| find "\\"') do @copy /y "\\server\share\path\source.bmp" "%a\admin$"

    This relies on all workstations being visible to the "net view" command - which also means they must be booted.  As long as the script is run by an Admin, it should work fine, provided you haven't removed administrative shares on the clients.

    If you want to put this into a DOS Script, make sure to double the % signs - %%a instead of %a.

    You can also have a script that runs longer and records each machine successfully copied to, another version that copies by IP Address instead of computer name.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    759 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

    8 Experts available now in Live!

    Get 1:1 Help Now