Richard
Sun Aug 13 19:57:44 CDT 2006
<faronhiebert@gmail.com> wrote in message
news:1155413384.307311.243390@74g2000cwt.googlegroups.com...
>I am new to scripting and I am trying to figure out how to do the
> following:
>
> Have a login script check to see if the computer running the script is
> a member of a specific group. If it is, then do one thing. If not,
> then do something else.
>
> I am using VBScript to map drives based the users group membership but
> I am not sure how to check the computer group membership.
>
> Any advice?
Hi,
Treat the computer object exactly like a user object. In a logon script you
can retrieve the NetBIOS name of the computer from the wshNetwork object.
Then you need to use the NameTranslate object to convert this to the
Distinguished Name (DN) required by the LDAP provider. The trick is knowing
that the sAMAccountName of the computer object is the NetBIOS name with "$"
appended on the end. Even better, if all clients are w2k or above, you can
use the ADSystemInfo object to retrieve the DN of the computer object
directly:
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName
Set objComputer = GetObject("LDAP://" & strComputerDN)
Examples at this link, including using NameTranslate if you have Win9x
clients:
http://www.rlmueller.net/freecode2.htm
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net