Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using VBScript in NT Login Script

24 views
Skip to first unread message

Treve Suazo

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
I'm looking for an object or function that will allow me to check user group
memberships. Is it possible to determine, during the login script, if
someone is a member of a NT group withing the SAM database? Any help
pointing me in the right direction would be great.

Thanks,
Treve Suazo

Joe Finley

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
Treve,

Thats what I'm doing now...here....


'Init Groups
Dim UserGroups
Dim GroupObj
UserGroups=""
For Each GroupObj In UserObj.Groups
UserGroups=UserGroups & "[" & GroupObj.Name & "]"
Next

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")
'
If InGroup("Domain Admins") Then
WSHNetwork.MapNetworkDrive "Q:", "\\server\y"
WSHNetwork.MapNetworkDrive "R:", "\\server\z"
End If
'
If InGroup("Domain Users") Then
WSHNetwork.MapNetworkDrive "W:", "\\server\x"
End If
'
If InGroup("Developer") Then
WSHNetwork.MapNetworkDrive "J:", ServiceBru
WSHNetwork.MapNetworkDrive "W:", "\\server\x"
WSHNetwork.MapNetworkDrive "Q:", "\\server\y"
WSHNetwork.MapNetworkDrive "R:", "\\server\z"
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: Check if user is in Group
' Arguments: Group to check membership of
' Note: Requires pre-initialization of UserGroups variant
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function InGroup(strGroup)
InGroup=False
If InStr(UserGroups,"[" & strGroup & "]") Then
InGroup=True
LoginMsg strGroup
End If
End Function

"Treve Suazo" <tsu...@misscrit.com> wrote in message
news:#MP0ngru$GA....@cppssbbsa02.microsoft.com...

Spencer Tabbert

unread,
May 12, 2000, 3:00:00 AM5/12/00
to
Thats because I believe he left off a couple lines of code in which he sets
Userobj to an object.

spence


"Treve Suazo" <tsu...@misscrit.com> wrote in message

news:uRXLLG5u$GA....@cppssbbsa02.microsoft.com...
> If I Cut and Paste this code and make a couple of modifications to
> groupnames within the InGroup Function. Changes to the drive mappings
with
> a valid server name and share name, the code bombs out on line 5 stating
> Error: "Object Required 'UserObj'". I've attached a bmp of the error
> message and was wondering if I'm missing something.
>
> Thanks,
> Treve
>
> "Joe Finley" <jfi...@prcontrol.com> wrote in message
> news:nzkS4.414$6T3....@typhoon.neo.rr.com...

Maurice Childs

unread,
May 17, 2000, 3:00:00 AM5/17/00
to
For what it's worth here is my version - it doesn't require a preinitialised
string of the users groups. On the other hand it will be slower

Function InGroup(strGroup)

InGroup=False
Set UserObj = GetObject("WinNT://" & DomainName & "/" & strUserID)

For Each GroupObj In UserObj.Groups

InGroup=InStr(Ucase(GroupObj.Name),Ucase(strGroup)) > 0 or InGroup
Next

End Function
Maurice Childs
MCSE MCP+I

> "Treve Suazo" <tsu...@misscrit.com> wrote in message

0 new messages