Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
M$3 January 27, 2009 08:36 PM

How can I make a batch file that copies text from a .txt file on one domain to a text file on another domain?

This is a bit difficult to explain but here are the basics of what I am trying to do. This would be a fun little thought experiment for a computer person. 

MachineA is in DomainA.

MachineB is in DomainB.

MachineA is the only machine that can access MachineB on DomainB.

MachineB CANNOT access MachineA on DomainA.

So say I am on a random server. I want to click a batch file and have it connect to DomainA\MachineA and then copy text from a file on DomainB\Machine B down to a file on DomainA\MachineA.

I think I am on the right track, I just don't know the syntax for this...

psexec \\MachineA TYPE -u domain\user -p password \\MachineB\X\B.TXT>>\\MachineA\X\A.TXT

The above command is just random and may not make sense, it is just a linear idea of what I am trying to do. I connect to \\MachineA with my own credentials, and then from there run a command (TYPE) to pull back data from MachineB and then >> addend a file on MachineA.

I just don't know how to pass credentials to the server on a different domain without using psexec, and I can't use psexec because MachineB CANNOT see MachineA.

Confusing? =)

Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Chosen by Asker

 
January 27, 2009 08:54 PM
What if you incorporate commands in the batch file to map a drive letter temporarily to B from A?

For example:

NET USE X: \\MachineA\Folder /USER:YourDomain\Username password
NET USE Y: \\MachineB\Folder /USER:YourDomain\Username password

TYPE Y:\B.TXT >> X:\A.TXT

rem remove drive mappings
NET USE X: /D
NET USE Y: /D

If you go this route, make sure the user account is one that doesn't have access to anything vital on your domains, since the user's password in this case would be plainly visible from at least MachineA and from wherever the batch file is kept.

I wonder if you might be better off using Group Policy to make this happen; like maybe set up a folder which gets replicated (or even just uses a scheduled task periodically to scan the folder for changes and update the remote folder when necessary).
Asker's Rating:
• Great idea. The only issue was the syntax was a bit off.

For any interested parties, the correct syntax is:

NET USE X: \\MachineA\Folder password /USER:domain\username


Helpful Answer?  (0)   (0)    Tip darth continent for this answer
Permalink | Report
   Reply  
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    27184 Points
    M$783.09 Earned
  • opher
    opher
    Purple Belt
    4186 Points
    M$192.17 Earned
  • annelisle
    annelisle
    Purple Belt
    2726 Points
    M$82.97 Earned
   See All
 

Most Popular Tags

mahalo(1602)
iphone(462)
music(459)
google(355)
food(320)
online(294)
beer(279)
money(262)
movies(255)
apple(251)
aotd(235)
health(217)
video(206)
dog(205)
free(203)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.