Using Languard and VBscript

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:"
InsightMediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EDDYKTCommented:
does net use work for you?
0
InsightMediaAuthor Commented:
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
EDDYKTCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
InsightMediaAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.