http://expert.csdn.net/Expert/topic/1203/1203572.xml?temp=.4265711

解决方案 »

  1.   

    你完全可以引用Windows自代的一个ocx引用
    打开VB 选择引用
    win200/xp 是 System32/wshom.ocx 
    9x是System32/wshom.ocx
    引用后打开对象浏览器会看到 IWshRuntimeLibrary 里边有你
    WshNetwork 类封装了想要的(其实这个引用有很多作用的
    如:读写注册表超作文件等等.....)
    下面是Win98自代的一个(Network.vbs 还有几个js,vbs也很有用)脚本 
    很容易就可以翻译成VB代码如下:
    (这个代码不用引用但没联想修改一下即可用在ASP):
    '/*--------------------START-----------------------------------*/
    Dim WSHNetwork
    Dim colDrives, SharePoint
    Dim CRLFPrivate Sub Form_Load()
    CRLF = Chr(13) & Chr(10)
    'Dim WSHNetwork As New WSHNetwork
    '入引用了 wshom.ocx 可入上行那样 会有联想
    Set WSHNetwork = CreateObject("WScript.Network")
    Call Welcome
    MsgBox "UserDomain" & Chr(9) & "= " & WSHNetwork.UserDomain & CRLF & _
           "UserName" & Chr(9) & "= " & WSHNetwork.UserName & CRLF & _
           "ComputerName" & Chr(9) & "= " & WSHNetwork.ComputerName, _
           vbInformation + vbOKOnly, _
           "WSHNetwork 属性"
           If Ask("要连接网络驱动器吗?") Then
        strShare = InputBox("请输入要连接的网络共享名称")
        For intDrive = 26 To 5 Step -1
            If TryMapDrive(intDrive, strShare) Then Exit For
        Next    If intDrive <= 5 Then
            MsgBox "无法连接到网络共享。 " & _
                   "现在没有可用的驱动器号。 " & _
                   CRLF & _
                   "请断开一个现存网络连接 " & _
                   "并重新运行此脚本。 ", _
                   vbExclamation + vbOKOnly, _
                   L_Welcome_MsgBox_Title_Text
        Else
            strDrive = Chr(intDrive + 64) & ":"
            MsgBox "已连接 " & strShare & " 到驱动器 " & strDrive, _
                   vbInformation + vbOKOnly, _
                   L_Welcome_MsgBox_Title_Text        If Ask("要断开刚创建的网络驱动器吗?") Then
                WSHNetwork.RemoveNetworkDrive strDrive            MsgBox "已断开驱动器 " & strDrive, _
                       vbInformation + vbOKOnly, _
                       L_Welcome_MsgBox_Title_Text
            End If
        End If
    End If
    If Ask("要列出已连接的网络驱动器吗?") Then
        
        Set colDrives = WSHNetwork.EnumNetworkDrives     If colDrives.Count = 0 Then
            MsgBox "没有可列出的驱动器。", _
                   vbInformation + vbOKOnly, _
                   L_Welcome_MsgBox_Title_Text
        Else
            strMsg = "当前网络驱动器连接: " & CRLF
            For i = 0 To colDrives.Count - 1 Step 2
                strMsg = strMsg & CRLF & colDrives(i) & Chr(9) & colDrives(i + 1)
            Next
            
            MsgBox strMsg, _
                   vbInformation + vbOKOnly, _
                   L_Welcome_MsgBox_Title_Text    End If
    End If
    End Sub
    Function Ask(strAction)    Dim intButton
        intButton = MsgBox(strAction, _
                           vbQuestion + vbYesNo, _
                           L_Welcome_MsgBox_Title_Text)
        Ask = intButton = vbYes
    End FunctionFunction TryMapDrive(intDrive, strShare)
        Dim strDrive
        strDrive = Chr(intDrive + 64) & ":"
        On Error Resume Next
        WSHNetwork.MapNetworkDrive strDrive, strShare
        TryMapDrive = Err.Number = 0
    End Function
    '
    Sub Welcome()
    L_Welcome_MsgBox_Message_Text = "此脚本显示如何使用 WSHNetwork 对象。"
    L_Welcome_MsgBox_Title_Text = "Windows Scripting Host 范例"
        Dim intDoIt    intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
                          vbOKCancel + vbInformation, _
                          L_Welcome_MsgBox_Title_Text)
        If intDoIt = vbCancel Then
            End
        End If
    End Sub
    '/*--------------------END-----------------------------------*/
      

  2.   

    wshom.ocx 有超作注册表的函数包(我不知道是否)可连接远程计算机的注册表如果可以就可查到你想要的信息!
    [HKEY_USERS\S-1-5-21-117609710-789336058-842925246-500\Software\Microsoft\Windows\CurrentVersion\Explorer]HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    建下都有
    (那位大虾知道!请告知谢谢!)
    [email protected]
      

  3.   

    命令行工具 :Net view
    显示域列表、计算机列表或者由指定计算机共享的资源。 
    如: shell "Net view>>d:\nte.txt" 
    然后分析即可获得全部的计算机列表
    或 shell net view \\[计算机名]>>d:\net.txt
    可获得 想要的计算机的全部共享目录 C$ D$ 这些除外