我如何知道用户映射的networking驱动器?

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

这是在Active Directory 2003域中的公司环境中。 我目前使用运行“networking使用”和pipe道到日志文件的SMS 2003广告。 打到每个桌面都需要很长时间。 有没有更好的办法?

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

所有这些答案是让我走的很好的线索。 谢谢。

我遇到了这个VBScript的例子 ,这正是我正在寻找和很好地工作。

以下是该post的代码片段:

'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 

可能有更好的办法,但是现在的做法其实很好,虽然速度很慢,但速度不应该成为问题。

你的用户每天都不改变他们的映射,即使他们你可能只关心那些相对永久的映射。

运行networking广告虽然需要一段时间,但每个月只需要做几次就可以保持驱动器映射。

-亚当

我实际上是在一个时间点编写了一个程序,作为login脚本的一部分运行,然后收集这些信息,然后用网站发布到数据库。 这会是你有兴趣运行的东西吗? 如果你喜欢,我可以把旧的代码清除掉,然后把它交给你。