Solved

Copying file across domains using scripting

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now