Thanks, I get it now. We are adding the Everyone group to another group.
So I replicated this and the easiest fix is to remove the group as you did. The crash only happens when using struser/strpass against a remote computer and from what I can tell is not a crash that vbscript can trap or ignore. It looks like the crash happens when accessing objGroup.Members.
I don't have the time to figure out a workaround (if any.) And we don't use struser/strpass or have "Everyone" in any of our groups so we're not affected. Hopefully someone else can step in.
Minimized code for testing: [code]strcomputer = "computer" system_hostname = strcomputer struser = "computer\Administrator" strpass = "password" Const wbemConnectFlagUseMaxWait = 128
Const ADS_SECURE_AUTHENTICATION = 1 Const ADS_USE_ENCRYPTION = 2
Set wmiLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = wmiLocator.ConnectServer(strcomputer, "\root\cimv2",struser,strpass, "", "", wbemConnectFlagUseMaxWait) set colItems = objWMIService.ExecQuery("Select * from Win32_Group where Domain = '" & system_hostname & "'",,32) for Each objItem in colItems 'wscript.echo "colItems name: " & objItem.Name set objDSO = GetObject("WinNT:") set colGroups = objDSO.OpenDSObject("WinNT://" & system_hostname & "", struser, strpass, ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION ) colGroups.Filter = Array("group") group_members = "" for Each objGroup In colGroups if objGroup.Name = objItem.Name then for each objUser in objGroup.Members wscript.echo "ADSPath: " & objUser.ADSPath group_domain = split(objUser.ADSPath, "/") member_domain = group_domain(ubound(group_domain)-1) group_members = group_members & objUser.Name & "@" & member_domain & ", " next end if next next[/code]
|