有人可以提供一些VBS脚本的帮助吗?
这是我迄今为止修改的内容。
Const GROUP1 = "cn=GROUP1" Const GROUP2 = "cn=GROUP2" Const GROUP3 = "cn=GROUP3" Set wshNetwork = CreateObject("WScript.Network") Set ObjectUser = CreateObject("ADSystemInfo") Set CurrentUser = GetObject("LDAP://" & ObjectUser.UserName) strGroups = LCase(Join(CurrentUser.MemberOf)) If InStr(strGroups, LCase("GROUP1")) Then wshNetwork.MapNetworkDrive "L:", "\\servername\\volume1\" End If If InStr(strGroups, LCase("GROUP2")) Then wshNetwork.MapNetworkDrive "M:", "\\servername\volume2\" End If If InStr(strGroups, LCase("GROUP3")) Then wshNetwork.MapNetworkDrive "N:", "\\servername\volume3\" End If
我不确定如何最好和最简单的方式来检索LDAPstring? 我也不断收到Set CurrentUser = GetObject("LDAP://" & ObjectUser.UserName) 。
任何帮助将非常感激。
如果您使用“组策略首选项”映射驱动器并进行项目级目标以按组筛选驱动器映射,则会更容易。 这是首选的方法。
我确信有一百个和一个解决scheme映射基于组成员的驱动器。 你可以在这里find我的。 它使用VBScript和其他一些和CMD壳。 也许你不需要重新发明轮子。