Solved

Copying file across domains using scripting

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

9 Experts available now in Live!

Get 1:1 Help Now