Solved

Copying file across domains using scripting

Posted on 2006-06-20
6
200 Views
Last Modified: 2010-04-13
I have a file that I want to copy from one Windows 2000 server in one domain to another Windows 2000 server in another domain using scripting.

I run the following script on the server.

' VBScript source code
set objFSO = CreateObject("scripting.fileSystemObject")
WScript.Echo("beginning copy of tech request database now...")
objFSO.CopyFile "d:\databases\techrequests.mdb","\\poky\Dept\Technology\Backup\TechRequests",true
WScript.Echo("copy of tech request database finished.")

I get a permissions denied error code 800A0046. I think I am getting this message because I am going across domains.

Is there some way I could provide authentication of username, password, and domain name in my script? Or is there another way to approach this?

Please be gentle as I am new to scripting!
0
Comment
Question by:FrankeButler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16944038
Well you could map a drive using a specific username, I presume there is no trust there between the domains as otherwise it would just work, there is a script here at the bottom of the page (pasted below too:).  If there is a trust maybe it is name resolution problem, try using IP address \\ipaddress\share

http://www.computerperformance.co.uk/ezine/ezine31.htm

==========PASTED=============

' TestConnect.vbs - Map Network Drive to N: to the alan server
' VBScript using all 5 MapNetworkDrive arguments.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.1 - May 30th 2004
' -----------------------------------------------------------------'
' object.MapNetworkDrive 5 arguments
' (strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])

Option Explicit
Dim strUser, strPassword, strDriveLetter, strHomeServer, strProfile
Dim objNetwork, objPopUp
Set objNetwork = CreateObject("WScript.Network")
Set objPopUp = CreateObject("WScript.Shell")

strDriveLetter = "N:"
strHomeServer = "\\alan\home"
strProfile = "False"   ' Mapping (not) stored in user Profile
strUser = "Administrator"
strPassword = "B££r & L@ger"

objNetwork.MapNetworkDrive strDriveLetter, strHomeServer, strProfile, strUser, strPassword
objPopUp.popup "Drive " & strDriveLetter & " connected successfully."

WScript.Quit

' End of example VBScript
0
 

Author Comment

by:FrankeButler
ID: 16945585
Actually, there is a trust, but I found out what I was doing wrong.

I failed to include the file name in the destination. I only included the folder name where it was being copied to. Once I specified a file name, it worked without a problem.

Thanks anyway.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16945668
Fair enough.  So you did, the paths being long made it a bit unreable.  You might find just specifying a trailing backslash on the destination without filename might work too but specifying a dest, file is belt and braces approach.

I don't know, you try to help then people fix it themselves :-)

As you probably know you can post in Community Support area if you want some or all points back.

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17244368
ok by me
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17262745
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Read  the original post  on Monitis Blog. Hi.  My name is Erik Dietrich, and this is the first time I’ve posted on the Monitis blog.  By way of introduction, I thought it would make sense to talk about my initial experience with Monitis.   Befo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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