?
Solved

Using Languard and VBscript

Posted on 2006-04-14
4
Medium Priority
?
358 Views
Last Modified: 2010-10-05
I am using languard to run a vbscript that will temporarily map a drive and then remove the mapped drive.  When I run the script locally, it runs without a hitch.  When I push the script to another machine, I get a "800700005 Access denied error".  The error occurrs on the line where the MapNetworkDrive method exists.  My script is below.  I've tried using different credentials, but it doesn't matter. I get the same results.  Any help would be appreciated.

Dim WSHNetwork

Set WSHNetwork = WScript.CreateObject("WScript.Network")

WSHNetwork.MapNetworkDrive "G:", "\\ima4\netlogon\manualupdates"


Const OverwriteExisting = TRUE

Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "g:\scx2kpx.xslt" , "C:\STRATA\VIEW32\Users\NS000000\scx2kpx.xslt", OverwriteExisting


WSHNetwork.RemoveNetworkDrive "G:"
0
Comment
Question by:InsightMedia
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16458561
does net use work for you?
0
 

Author Comment

by:InsightMedia
ID: 16468639
Well, yes & no.  The batch file would be much less complicated, I admit.

I originally created a batch file thtat contained "net use g: \\ima4\netlogon\manualupdates" (which operated seemlessly), but I ran into a snag using the xcopy command.  I want the script/batch file to execute w/no interaction from the users.

The xcopy command prompts to "create file or directory" & prompts overwrite protection.  I know that both of these are supposed to have the ability to be disabled with /I and /Y respectively, but the "/I" doesn't seem to work.  I even tried "Echo /I|xcopy" with no luck.  That issue prompted to switch to a scripting method, which works flawlessly when excuted at the desktop but not when being pushed to the desktop.

Any tips here?  Am I making this too complicated?  Am I overlooking something here?  I am getting down to the wire & need to push this out.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 1600 total points
ID: 16468955
Ok,

if net use works for you use it


i.e from vbscript

Dim wshShell, objEnvironment
Set wshShell = CreateObject("WScript.Shell")
Set objEnvironment = wshShell.Environment("System")
wshShell.Run objEnvironment.Item("COMSPEC") & " /c net use g: \\ima4\netlogon\manualupdates",, true

Const OverwriteExisting = TRUE

Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "g:\scx2kpx.xslt" , "C:\STRATA\VIEW32\Users\NS000000\scx2kpx.xslt", OverwriteExisting


Set objEnvironment = Nothing
Set wshShell = Nothing
0
 

Author Comment

by:InsightMedia
ID: 16469353
I didn't know about "COMPSPEC".  I had to add credentials to the net use command & deleted the drive after copying the file.  After that, it worked great!  Thanks for your help!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

809 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