AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 990
Accepted
spoulson
spoulson
Asked: 2009-05-01 07:06:36 +0800 CST2009-05-01 07:06:36 +0800 CST 2009-05-01 07:06:36 +0800 CST

我如何知道用户映射了哪些网络驱动器?

  • 772

扫描以查找为域中所有桌面上的所有登录用户设置的驱动器映射的最佳方法是什么?这将用于确定环境中正在使用的驱动器号。

这是在 Active Directory 2003 域内的公司环境中。我目前使用运行“网络使用”并通过管道传输到日志文件的 SMS 2003 广告。访问每个桌面需要很长时间。有没有更好的办法?

windows networking
  • 4 4 个回答
  • 2028 Views

4 个回答

  • Voted
  1. Glen Solsberry
    2009-05-01T07:47:05+08:002009-05-01T07:47:05+08:00

    最快的方法可能是使用WMI。如果您精通 Perl,您甚至可以使用Win32模块。在这里的某个地方,我有一个脚本可以提供大部分信息。

    • 1
  2. Best Answer
    spoulson
    2009-05-08T04:00:39+08:002009-05-08T04:00:39+08:00

    所有这些答案都是让我前进的很好的线索。谢谢你。

    我碰巧遇到了这个 VBScript 示例,它完全符合我的要求并且运行良好。

    这是该帖子的代码片段:

    'Define variables, constants and objects
    
    strComputer="REMOTE MACHINE HERE"
    Const HKEY_USERS = &H80000003
    Set objWbem = GetObject("winmgmts:")
    Set objRegistry = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
    Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
    'Go and get the currently logged on user by checking the owner of the Explorer.exe process.  
    
    Set colProc = objWmiService.ExecQuery("Select Name from Win32_Process" & " Where Name='explorer.exe' and SessionID=0")
    
    If colProc.Count > 0 Then
       For Each oProcess In colProc
           oProcess.GetOwner sUser, sDomain
       Next
    End If
    
    'Loop through the HKEY_USERS hive until (ignoring the .DEFAULT and _CLASSES trees) until we find the tree that 
    'corresponds to the currently logged on user.
    lngRtn = objRegistry.EnumKey(HKEY_USERS, "", arrRegKeys)    
    
    For Each strKey In arrRegKeys
       If UCase(strKey) = ".DEFAULT" Or UCase(Right(strKey, 8)) = "_CLASSES" Then
       Else
    
           Set objSID = objWbem.Get("Win32_SID.SID='" & strKey & "'")
    
    'If the account name of the current sid we're checking matches the accountname we're looking for Then
    'enumerate the Network subtree
           If objSID.accountname = sUser Then 
               regpath2enumerate = strkey & "\Network" 'strkey is the SID
               objRegistry.enumkey hkey_users, regpath2enumerate, arrkeynames
    
    'If the array has elements, go and get the drives info from the registry
               If Not (IsEmpty(arrkeynames)) Then
                   For Each subkey In arrkeynames
                       regpath = strkey & "\Network\" & subkey
                       regentry = "RemotePath"
                       objRegistry.getstringvalue hkey_users, regpath, regentry, dapath
                       wscript.echo subkey & ":" & vbTab & dapath
                   Next
               End If
           End If
       End If
    Next
    
    • 1
  3. Adam Davis
    2009-05-01T07:23:39+08:002009-05-01T07:23:39+08:00

    可能有更好的方法,但是你现在做的方法其实很好,虽然感觉很慢,但速度应该不是问题。

    您的用户不会每天更改他们的映射,即使他们是,您也可能只关心那些相对永久的映射。

    运行网络使用广告虽然需要一段时间,但只需每月执行几次即可掌握驱动器映射。

    -亚当

    • 0
  4. Steven Behnke
    2009-05-01T07:49:38+08:002009-05-01T07:49:38+08:00

    实际上,我在某个时间点编写了一个程序,该程序将作为登录脚本的一部分运行并收集该信息,然后将其发布到带有网站的数据库中。这会是你对跑步感兴趣的事情吗?如果你愿意,我可以把旧代码掸掉并交出。

    • 0

相关问题

  • 您最喜欢的云计算提供商是什么?[关闭]

  • Vanilla Powershell 是否足以成为 Windows 和 DB 服务器管理员的语言?

  • 为什么添加新驱动器后我的磁盘驱动器访问速度如此之慢?

  • 在 Windows Server 2003 下使用 wscipt 从 .asp 文件运行 .exe

  • 最佳混合环境(OS X + Windows)备份?[关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve