home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2763
Discussions: 188,384, Posts: 2,243,508, Members: 232,615
Old February 28th, 2003, 03:26 PM   Digg it!   #1 (permalink)
RAR
Member
 
RAR's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 408
Help - Mapping a drive with an asp using vbs...

Here is a vbs script that maps a drive fine from my computer:

Dim WshNetwork ' As IWshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")

Dim FSO ' As FileSystemObject
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")

Const DriveLetter = "r:"
Const SharePath = "\\computer\path"

If FSO.DriveExists(DriveLetter) Then
' Do nothing
Else
WshNetwork.MapNetworkDrive DriveLetter, SharePath
End If

Set FSO = Nothing
Set WshNetwork = Nothing

The trouble begins when I try to put that script in an asp page so when it runs from a web page it will map to a drive on my server and copy down a couple files from my server to a client computer. It gives me an error that says, "Variable is undefined: 'WScript'." Or does anybody know a different or easier way to have it copy files down to a client by just clicking on a button. Thanks in advance for any help.

RAR

RAR is offline   Reply With Quote
Old February 28th, 2003, 09:04 PM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
WScript objects need to be called from cscript.exe or wscript.exe. Being able to modify network drives from a web browser is asking a lot

I believe you could create an activex control to do it, but it would have to run in a different zone, it shouldnt' be able to run from an internet zone.
Why don't you just put the script in your login startup?
Or is this not a local (intranet) server?
You could put it on a ftp server and write a script for that...

vass0922 is offline   Reply With Quote
Old March 1st, 2003, 03:51 PM     #3 (permalink)
RAR
Member
 
RAR's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 408
Thanks Vass. It needs to be as easy as possible for the users. That's why I need them to just click on one button and have everything done in the background. It's a very picky group of users and the less they have to do the better.

If I can't get it to work like that then maybe I'll have to have it call a batch file and let it map that way. That's the way I originally had it working, it just doesn't look as nice with the dos window popping up and then not closing on exit.

RAR is offline   Reply With Quote
Old March 1st, 2003, 08:03 PM     #4 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
Try putting 'exit' at the end of the batch file, it should automatically exit the console.

You could still have them use your initial vbs to map drives locally, just save it as a .vbs file somewhere

It really makes no difference but another way to do

If FSO.DriveExists(DriveLetter) Then
' Do nothing
Else
WshNetwork.MapNetworkDrive DriveLetter, SharePath
End If

would be
If Not FSO.DriveExists(DriveLetter) Then
WshNetwork.MapNetworkDrive DriveLetter, SharePath
End If

vass0922 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2896)
CPU wont boot (6)
3-days in and no threads about Gaza (160)
The United States Debt (20)
I think I just killed my computer w.. (24)
hp compaq nc6000 problems (139)
Upgrading RAM (5)
Folderchat Weekday thread (442)
Antec 300 bulk purchase? (11)
Recent Discussions
CPU wont boot (6)
GLaDOS is up. (3)
HP notebook reinstall Vista NO .. (5)
Building a gaming computer advi.. (4)
hp compaq nc6000 problems (139)
Folderchat Weekday thread (442)
Creative T-3000 Subwoofer (3)
ACPI controller halt on boot (2)
Worth the upgrade?? (15)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 10:31 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28