Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Error Local Device already in use

Status
Not open for further replies.

OLDMO

MIS
Aug 13, 2003
95
US
I know I need to dissconnect drive w before I run this script..what is the syntax to do this...I've tried and can't figure it out since I'm new to vbscript. Here is my script this far.


ONST ForAppending = 8
reason = InputBox("Why are you accessing the server? Please give a reason. note: A blank response will be questioned by OMNB management!","Authorized Personnel Only!!!!")


Set fso = CreateObject("Scripting.FileSystemObject")
Set WSHNetwork = CreateObject("Wscript.Network")
WSHNetwork.MapNetworkDrive "w:", "\\*******\********",True
report = WSHNetwork.Username & " accessed the server at "& Now & " for the following reason:" & vbCrLf
report = report & reason & vbCrLf

If Not fso.FileExists("w:\sunshineserverlogin.txt") Then
fso.CreateTextFile ("w:\serverlogin.txt")
End If
Set ts = fso_OpenTextFile ("w:\sunshineserverlogin.txt", ForAppending)
ts.write report
 
Have you tried this ?
WSHNetwork.RemoveNetworkDrive "w:"

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
sorry why do you need to connect a drive in the first place? if all you are doing is reading, writing, creating, files/folders etc on a computer then you dont need to map a drive at all......
 
This is a server and I want it to create the file in a folder on our main server where the other logs will be placed.
 
again, i still dont think you need to map a drive.
cany you just use the url \\sername\sharename\filename etc
 
I agree with mrmovie, the fso can handle UNC.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top