Solved

Copying file across domains using scripting

Posted on 2006-06-20
6
199 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
  • 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

827 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