InsightMedia
asked on
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("WScr ipt.Networ k")
WSHNetwork.MapNetworkDrive "G:", "\\ima4\netlogon\manualupd ates"
Const OverwriteExisting = TRUE
Set FSO = CreateObject("Scripting.Fi leSystemOb ject")
FSO.CopyFile "g:\scx2kpx.xslt" , "C:\STRATA\VIEW32\Users\NS 000000\scx 2kpx.xslt" , OverwriteExisting
WSHNetwork.RemoveNetworkDr ive "G:"
Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScr
WSHNetwork.MapNetworkDrive
Const OverwriteExisting = TRUE
Set FSO = CreateObject("Scripting.Fi
FSO.CopyFile "g:\scx2kpx.xslt" , "C:\STRATA\VIEW32\Users\NS
WSHNetwork.RemoveNetworkDr
does net use work for you?
ASKER
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\manualupda tes" (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.
I originally created a batch file thtat contained "net use g: \\ima4\netlogon\manualupda
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!!