Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
public WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "L:", "\\10.110.69.120\C$", false, username, password
public WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
on error resume next 'begins error catching
WshNetwork.MapNetworkDrive "L:", "\\10.110.69.120\C$", false, username, password
if err.number <> 0 then
'do here your error handling
err.clear
on error goto 0 'ends error catching
end if
REPLY:
public WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
if fso.DriveExists("L:") Then
WshNetwork.RemoveNetworkDrive "L:", True
WshNetwork.MapNetworkDrive "L:", "\\10.110.69.120\C$", false, username,
password
Else
WshNetwork.MapNetworkDrive "L:", "\\10.110.69.120\C$", false, username,
password
End If Regards
HANDLE: saw15
POSTED ON: Oct 28, 2002
REPLY:
How would I write a Case statement, to look for Drive letter?
REPLY:
dletter = "L:"
Set WshNetwork = CreateObject("WScript.Network")
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Select Case dletter
Case "L:"
if fso.DriveExists(dletter) Then
WshNetwork.RemoveNetworkDrive dletter, True
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\C$", false,
username, password
Else
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\C$", false,
username, password
End If
Case "M:"
if fso.DriveExists(dletter) Then
WshNetwork.RemoveNetworkDrive dletter, True
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\D$", false,
username, password
Else
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\D$", false,
username, password
End If
Case Else
if fso.DriveExists(dletter) Then
WshNetwork.RemoveNetworkDrive dletter, True
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\E$", false,
username, password
Else
WshNetwork.MapNetworkDrive dletter, "\\10.110.69.120\E$", false,
username, password
End If
End Select
Private Sub Form_Load()
Dim Network
Dim Drives
Dim Printers
Set Network = CreateObject("WScript.Network")
Set Drives = Network.EnumNetworkDrives
Set Printers = Network.EnumPrinterConnections
For i = 0 To Drives.Count - 1 Step 2
MsgBox "Connected drive: " & Drives.Item(i + 1)
Next
For i = 0 To Printers.Count - 1 Step 2
MsgBox "Printer: " & Printers.Item(i + 1) & vbCrLf & "Port: " & Printers.Item(i)
Next
MsgBox "UserDomain : " & Network.UserDomain & vbCrLf & _
"UserName : " & Network.UserName & vbCrLf & _
"ComputerName : " & Network.ComputerName, _
vbOKOnly, "Network Properties"
Unload Me
End
End Sub