Getting user's groups 
Author Message
 Getting user's groups

For some reason, this works on some computers, and not on others.  They're
all NT4 with ADSI:

Sub Groupdrivemap
On error resume next 'Here only so that overlapping group membership or
persistant drives from WinNT doesn't cause a run-time error.
set domuser = GetObject("WinNT://DOMAIN/" & user)
 For each grp in domuser.Groups
  group = grp.Name
wscript.echo group ' <-- Getting blank box here on fautly machines.
 Select Case group

  Case "CM"
  WshNetwork.MapNetworkDrive "R:", "\\server\CM"

  Case "CS"
  WshNetwork.MapNetworkDrive "J:", "\\server\CS"

...

 End Select
 Next
 On error goto 0

End Sub

__________

If I comment outm "On error resume next", I get "The network path was not
found" at the line containing "set domuser = GetObject("WinNT://DOMAIN/" &
user)"

Any ideas?

Thanks,
Nathan



Sat, 08 May 2004 05:45:33 GMT  
 Getting user's groups
Google Usenet Advanced Search
http://groups.google.com/advanced_group_search

with the exact phrase: security rollup package

newsgroup: microsoft.public.scripting.*

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> For some reason, this works on some computers, and not on others.  They're
> all NT4 with ADSI:

> Sub Groupdrivemap
> On error resume next 'Here only so that overlapping group membership or
> persistant drives from WinNT doesn't cause a run-time error.
> set domuser = GetObject("WinNT://DOMAIN/" & user)
>  For each grp in domuser.Groups
>   group = grp.Name
> wscript.echo group ' <-- Getting blank box here on fautly machines.
>  Select Case group

>   Case "CM"
>   WshNetwork.MapNetworkDrive "R:", "\\server\CM"

>   Case "CS"
>   WshNetwork.MapNetworkDrive "J:", "\\server\CS"

> ...

>  End Select
>  Next
>  On error goto 0

> End Sub

> __________

> If I comment outm "On error resume next", I get "The network path was not
> found" at the line containing "set domuser = GetObject("WinNT://DOMAIN/" &
> user)"

> Any ideas?

> Thanks,
> Nathan



Sat, 08 May 2004 06:46:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting user's groups/SRP

2. NT 4.0, user groups, PDC's, BDC's and IsMember

3. Add Domain Users Group to Powe Users Group in Script

4. Getting SIDs of Users/Groups from Vbscript

5. Getting users group

6. Problem getting list of groups user belongs to

7. Logon scripts specific to a user's domain group

8. Capturing logged-on user's Group Membership on NT 4 Network

9. Can't add user to a global group

10. enumerating membership of groups by the user's token

11. Getting WinNT 4 User's domain properties

12. Getting Current User's DN?

 

 
Powered by phpBB® Forum Software