Getting NT group membership with WSH 
Author Message
 Getting NT group membership with WSH

Is there a way to return which group or groups a NT user belongs to
using WSH on Windows 95/98?


Mon, 07 May 2001 03:00:00 GMT  
 Getting NT group membership with WSH
You have to use ADSI. I have an ADSI FAQ at my site. It includes several
examples on how to use ADSI with WSH.... check it out.

http://cwashington.netreach.net

Its in the script repository. Now for the code...

Set Group = GetObject("WinNT://Your_Domain/Your_Group", group)
If Group.IsMember("WinNT://Your_Domain/username") = true then
    'map a drive or something
Else
    'do something else here
End if

Clarence

Quote:

>Is there a way to return which group or groups a NT user belongs to
>using WSH on Windows 95/98?



Mon, 07 May 2001 03:00:00 GMT  
 Getting NT group membership with WSH
If you want a list of all the user groups for a given user then try this...

strUser = ""
While strUser = ""
  strUser = WSHNetwork.UserName
Wend
strDomain = "Your domain name" '**** change this ****
adsPath = "WinNT://" & strDomain & "/" & strUser
set adsObj = GetObject(adsPath)
For Each Prop In adsobj.groups
    sMsg = sMsg & Prop.Name & strLF
Next
WshShell.Popup "You have been logged onto " & strDomain & strLf &_
"with the following permissions:" & strLf &_
sMsg,  , "Logon Completed", 64

This code is in the sample logon script code found on the WSH FAQ WEB site
http://wsh.glazier.co.nz/frame.htm
Regards,
Ian

Quote:

>You have to use ADSI. I have an ADSI FAQ at my site. It includes several
>examples on how to use ADSI with WSH.... check it out.

>http://cwashington.netreach.net

>Its in the script repository. Now for the code...

>Set Group = GetObject("WinNT://Your_Domain/Your_Group", group)
>If Group.IsMember("WinNT://Your_Domain/username") = true then
>    'map a drive or something
>Else
>    'do something else here
>End if

>Clarence


>>Is there a way to return which group or groups a NT user belongs to
>>using WSH on Windows 95/98?



Tue, 08 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Getting Win98 to map drives based upon Group Membership

2. VBScript NT Login Script - checking for group membership

3. VBScript and NT Login Scripts - Group membership?

4. Testing for NT Group membership within VB Script

5. error when checking for NT group membership

6. Checking NT Group Membership

7. Testing NT 4 Group Membership

8. Determining NT Global Group Membership???

9. Checking for NT Domain Group Membership

10. Checking NT Group Membership

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

12. WSH to Update Group Membership.

 

 
Powered by phpBB® Forum Software