Solved

Copying file across domains using scripting

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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