有人能提供一些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我不确定如何以最佳和最简单的方式收回LDAP字符串?我还一直在Set CurrentUser = GetObject("LDAP://" & ObjectUser.UserName)上出错。
任何帮助都将不胜感激。
发布于 2012-03-13 11:11:56
如果您使用组策略首选项来映射驱动器,并进行项目级别的目标定位以按组筛选驱动器映射,则会容易得多。这是首选的方法。
发布于 2012-03-13 13:23:46
我确信有一百个基于组成员的映射驱动器的解决方案。你可以找到我的这里。其中有些使用vbscript,而另一些则使用cmd。也许你不需要重新发明轮子。
https://serverfault.com/questions/369136
复制相似问题