0
当运行下面的VBS函数来检查当前用户是否在某个安全组中时,对于行strGroup = LCase(Join(CurrentUser.MemberOf))
,我得到错误#500(变量未定义)。当定义了某个变量时,VBS函数总是返回False
我有Option Explicit
在脚本中声明,所以这并不奇怪。但是,当我声明变量(Dim strGroup
)时,该函数停止工作并始终返回false。
Function is_group_member(group)
Dim objNetwork
Dim objUser
Dim CurrentUser
' Set our default return value
is_group_member = False
' Directory Lookup
Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
strGroup = LCase(Join(CurrentUser.MemberOf))
' Set return value to true if the user is in the selected group
If InStr(strGroup, lcase(group)) Then
is_group_member = True
End If
End Function
感谢您的回复,我会看看。看起来您的调试器链接不正确,因为无法找到页面。谢谢。 –
感谢您对下载链接的反馈,我已经解决了它。 –
谢谢。参加几次会议,今天晚些时候会抓住它。 –