如何查看地图网络驱动器连接?

时间:2013-07-25 03:11:00

标签: vb.net

我想在映射网络驱动器之前检查网络驱动器是否有映射。 我使用此代码映射驱动器。

 Dim network = New IWshNetwork_Class()

                network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)

1 个答案:

答案 0 :(得分:2)

IWshNetwork_Class似乎是Windows脚本宿主对象模型COM库中的一个类。

Dim Network As IWshRuntimeLibrary.IWshNetwork_Class
Dim Drives As IWshRuntimeLibrary.IWshCollection_Class
Drives = Network.EnumNetworkDrives
For DriveCounter As Long = 0 To Drives.Count – 1 Step 2 
    MsgBox(Drives.Item(DriveCounter) & " is mapped to " & Drives.Item(DriveCounter + 1))
Next

请查看this PDF以获取更多信息......