+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    7

    running a batch file over two networks

     
    currently im running a batch file to automate backing up some important machine data. until now all machines were on the same internal network for ex 172.11.11.11. well now i have two machines that have been shipped half way across the country and on there own network which means the machines are not getting back up unless i do it manually. i do know the ip addresses of those two machines and can connect to them. but i cant seem to get my batch file to connect them anylonger. any suggestions?

  2. #2
    Goverment property now GroundZero3's Avatar
    Join Date
    Oct 2001
    Location
    NOVA
    Posts
    33,778
    Blog Entries
    46
    Curious have you tried the scheduling option with the built in backup feature in windows?

    As for the computer being on another network, with routers and firewalls that is what is blocking your ability to access the computer. Do you have the ability to remote control the machine at all?

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    yeah i can see everything on the d drive through network places on both the machines that are here and the two that are in newark. in the batch file there isnt any ip addresses used since the machines are all on the same network - or were until recently. i didnt write the batch file i simply inherited it so to speak.

  4. #4
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    here is the script they insist on using with astericks representing machine ID's
    thanks for any help you can give.


    @echo off
    SETLOCAL ENABLEDELAYEDEXPANSION
    ::for consistant time on all the machines. some machines have nt < sp3
    for /F "TOKENS=1* DELIMS= " %%A IN ('DATE /T') DO SET DATE=%%B
    for /F "TOKENS=*" %%A IN ('TIME /T') DO SET TIME=%%A
    rem set variables
    set data_dir=c:\anv_backup
    set tstamp=%date% %time%
    :main
    for %%a in (T2 T3 T4 T5 T6 T7 T8 T9 Q1 Q2 Q3) do (
    if %%a==T2 set ka=*****
    if %%a==T3 set ka=*****
    if %%a==T4 set ka=*****
    rem T1's ANV computer is installed on T5
    if %%a==T5 set ka=*****
    rem T5 normal ANV
    rem if %%a==T5 set ka=*****
    if %%a==T6 set ka=*****
    if %%a==T7 set ka=*****
    if %%a==T8 set ka=*****
    if %%a==T9 set ka=*****
    if %%a==Q1 set ka=*****
    if %%a==Q2 set ka=*****
    if %%a==Q3 set ka=*****
    echo %tstamp% starting up application backup. >>anv_backup.log
    rem create data directory if one dosen't exist.
    if not exist %data_dir%\%%a ( mkdir %data_dir%\%%a
    ) else echo.
    rem compress data
    7za a -tzip %data_dir%\%%a\%%a_ANV_%DATE:~0,2%_%DATE:~3,2%_%DA TE:~6,4%.zip \\A!ka!\d$\anv\*.*
    if exist %data_dir%\%%a\%%a_ANV_%DATE:~0,2%_%DATE:~3,2%_%DA TE:~6,4%.zip (echo Backup %%a complete. >>anv_backup.log
    ) else echo %tstamp% ANV Application Backup %%a failed. >>anv_backup.log

    rem delete up all but the last 3 backups
    for /f "skip=3 delims=" %%a in ('dir /o-d /b %data_dir%\%%a\*.zip') do (del %data_dir%\%%a\%%a)
    )
    :end

  5. #5
    Goverment property now GroundZero3's Avatar
    Join Date
    Oct 2001
    Location
    NOVA
    Posts
    33,778
    Blog Entries
    46
    We need a lot more information on the other network and your network. You said it was across the country which means its not a simple using computer names to copy files using batch files. You dont have direct access to the remote machine on other networks unless you have some sort VPN setup. Or maybe im confused which happens often.

  6. #6
    Ultimate Member quickoldcar's Avatar
    Join Date
    Oct 2004
    Location
    NE Pennsylvania
    Posts
    1,005
    Blog Entries
    1
    Take a look at pstools
    PsTools

    Look into using psexec and using it for a remote machine.
    PsExec

    microsoft has a live version I just noticed that can just link to
    Windows Sysinternals: Documentation, downloads and additional resources

    systeminternals forums for pstools
    PsTools - Sysinternals Forums - Page 1

    The way it goes something like this:

    psexec handles the connection and being able to handle applications over a server remotely, this includes a bat file. There are switches for different types of permissions, designation of script or file, username, password, file location

    Gonna have to allow it still to be able to connect as well. Also the permissions.

    I suggest reading up on it as it's a very handy tool and can do a lot having it.

    Just for instance, on my website I made a thumbserver, if the thumb isn't found it silently runs command in background, the cmd executes through psexec and opens an instance of firefox also in the background, takes a snapshot and saves it to a folder.

    Drop psexec.exe same folder.

    I'll even show you a sample of my code if helps any, of course you have something different.

    //silently execute exe command function - change windows to unix if need to
    function execInBackground($cmd) {
    if (substr(php_uname(), 0, 7) === "Windows"){
    pclose(popen("start /B ". $cmd, "r"));
    }
    else {
    exec($cmd . " > /dev/null &");
    }

    exec("Psexec.exe -i -d ./firefox/firefox.exe -savepng $finalurl -savedelay 3000");
    //psexec -accepteula D:\AppServ\www\firefox\firefox.exe -savepng Google


    Like I said may not help showing my code, but gives you an idea what you can do with psexec. Would also need to go to the apache service and allow log on interaction or user name and password.
    DynaIndex.com - Dynamic search index of websites, links, feeds, title, description, keywords and thumbnail snapshot.

  7. #7
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    ok ill check into the PStools thing when i get back to work. i was trying to come up with a way to use the ip address in the current batch file. I have tried to put the ip addy of the target machine in the following line just before the path of where the data is that needs to be backed up for ex

    7za a -tzip %data_dir%\%%a\%%a_ANV_%DATE:~0,2%_%DATE:~3,2%_%DA TE:~6,4%.zip 10.10.10.10.10\\A!ka!\d$\anv\*.*

    but this did not work of course. although i understand the concept and some of the commands used in the batch file its been a long long time since i had to do any of this.
    again thanks for the help and any further suggestions

  8. #8
    Member
    Join Date
    Jan 2002
    Location
    Rapid City, SD
    Posts
    40
    What about \\10.10.10.10\d$\anv\

  9. #9
    Goverment property now GroundZero3's Avatar
    Join Date
    Oct 2001
    Location
    NOVA
    Posts
    33,778
    Blog Entries
    46
    That (10.10.10.10) is a private network ip address which cant be routed over the internet

  10. #10
    [He who is Nude..] Nude_Lewd_Man's Avatar
    Join Date
    Mar 2007
    Location
    My own little world.
    Posts
    11,764
    I may have missed something in reading this, but:
    1) Can't you get the remote machines to connect to the 'main' network using VPN?
    2) If you're only using IP address/es, then if that remote machine gets a different IP address assigned to it, then your batch script will be borked again - it'd be much better to use a DNS/WINS name to resolve to the current IP of the machine/s instead.
    I've seen the light... It was green, flashy and attached to a Network Interface Card...
    Whenever someone says "You can't miss it", I invariably do...

    TechIMO Folding@home Team #111 - Crunching for the cure!IE Team111 FAQs TEAM STATS Apps

  11. #11
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    Thanks for the suggestions so far!
    Nude Lewd the IP addy is a static one so the batch file will not get borked due to a dynamic IP and I cant just install a VPN on the customers network they would get pretty irate with me for that.

    rcwabbits I tried that and it did not work!!


    what I dont understand is -- if I can see and access the shared D$ drives on the two machines why cant the batch/script file see access the machines????? the batch/script file executes from the same PC that I use to access the two machines that were moved.
    One other thing I have noticed is that any time I try to zip compress those target files on the machines that were moved, winzip times out with an interrupt error.

  12. #12
    [He who is Nude..] Nude_Lewd_Man's Avatar
    Join Date
    Mar 2007
    Location
    My own little world.
    Posts
    11,764
    Perhaps the script is running with credentials that don't have permissions on one/both of the computers..as the D$ share will be an 'admin' share, so it is likely that (unless permissions have been tweaked) it won't have access to the location.. Also, bear in mind that if there are any spaces in the target location/s, then the script may have an issue with that - unless you've wrapped the location/s in speech marks...

    It might help if you can post the locations in the script and also the error message you're seeing...
    I've seen the light... It was green, flashy and attached to a Network Interface Card...
    Whenever someone says "You can't miss it", I invariably do...

    TechIMO Folding@home Team #111 - Crunching for the cure!IE Team111 FAQs TEAM STATS Apps

  13. #13
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    Thanks for the quick reply!
    I dont think its a permissions thing due to the batch file worked just fine on the machines when they were here in my building. The only thing that has changed is that the target machines have been moved halfway across the country so im kinda stuck????? I dont get an error message or I havent seen one yet. I will check the logs and see if it has one.

  14. #14
    Junior Member
    Join Date
    Oct 2010
    Posts
    7
    thanks for all the help everyone. its finally been resoved. i wound realizing i was editing the wrong script. although the two were similar the one i was editing was not the one i needed to edit. rcwabbits had it correct by eliminating the A!ka! and using the ip addy.

    move \\10.10.10.10\d$\anv\data\*.* %data_dir%\%%aANV\%date:~10,4%_%date:~4,2%_%date:~ 7,2%

    thanks everyone again for all the help i greatly appreciated it

  15. #15
    [He who is Nude..] Nude_Lewd_Man's Avatar
    Join Date
    Mar 2007
    Location
    My own little world.
    Posts
    11,764
    I've done that before, but luckily it was only a (very) minor difference, and the script was working anyway..

    Glad to hear it is working now/again...
    I've seen the light... It was green, flashy and attached to a Network Interface Card...
    Whenever someone says "You can't miss it", I invariably do...

    TechIMO Folding@home Team #111 - Crunching for the cure!IE Team111 FAQs TEAM STATS Apps

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. DOS batch file to FTP download files by reading from the text file
    By Abhijat_TIMO in forum Applications and Operating Systems
    Replies: 0
    Last Post: September 13th, 2010, 02:02 PM
  2. Batch file to copy/rename file with current time
    By jp22382 in forum Applications and Operating Systems
    Replies: 2
    Last Post: May 19th, 2009, 06:25 AM
  3. Batch file or Script file ???
    By AndreL in forum Webmastering and Programming
    Replies: 3
    Last Post: September 26th, 2008, 06:14 AM
  4. Help Running Batch File
    By PeterGriffin in forum General Tech Discussion
    Replies: 1
    Last Post: January 13th, 2005, 12:41 PM
  5. DOS batch file for running CHKDISK? Can it be done?
    By Abi Normal in forum Applications and Operating Systems
    Replies: 3
    Last Post: June 29th, 2004, 03:42 AM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews