Re: Correct Syntax for group membership of two groups

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Charles E Finkenbiner (CharlesEF__at__MailandNews.Com)
Date: 06/19/04


Date: Sat, 19 Jun 2004 06:33:03 -0500

Hi Chuck,

Is there any more code? I do not see where you SET objUser. You Dim
it, but never SET it (in the code you supplied). I would start by
removing (commenting out) the On Error Resume Next line. The error
could be masked because of this line.

Hope this helps,

CEF

On 6/18/2004 11:41 AM, Chuck wrote:
> This is the script i am dealing with. the drives map, but it does not depend
> on permissions, it just maps it. obviously it is not looking to group
> membership for a condition to map the appropriate drives. a little help
> please.
>
> Option Explicit
> On Error Resume Next
>
> Dim objNetwork
> Dim strDriveLetter
> Dim strRemotePath
> Dim objuser
>
> Set objNetwork = WScript.CreateObject("WScript.Network")
>
> ' Map Drive for all users
>
> strDriveLetter = "N:"
> strRemotePath = "\\Server\Tools"
>
> objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
>
> ' Map all Group Specific Drives
>
> If IsMember(objUser, "Product Development") _
> AND IsMember( objUser, "Fullfillment") Then
> objNetwork.MapNetworkDrive "G:", "\\Server\Product"
> objNetwork.MapNetworkDrive "I:", "\\Server\Fullfillment"
> End If
>
> objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
>
> Wscript.Quit
>
>
>
> "Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in message
> news:eQDAplMVEHA.2544@TK2MSFTNGP10.phx.gbl...
>
>>"Chuck" <cholley_@hotmail.com> wrote in message
>>news:eCEqJMLVEHA.2972@TK2MSFTNGP11.phx.gbl...
>>
>>>I have several users who are members of two groups that need two
>
> different
>
>>>network drives. i am trying to map both of these to different drive
>>>letters, for one user who is a member of these two groups. i am not
>>
>>getting
>>
>>>any errors but nothing is getting mapped either. please assist. thanks
>>>
>>>If IsMember(objUser, "Product Development" AND objUser, "Fullfillment")
>>
>>Then
>>
>>> strDriveLetter = "G:"
>>> strRemotePath = "\\Lester\Product"
>>> strDriveLetter = "I:"
>>> strRemotePath = "\\Lester\Fullfillment"
>>> End If
>>
>>Nowhere in the above code do you use the MapNetworkDrive method of the
>>network object, you just set some variables that you might use in such a
>>call, but then do nothing with them.
>>
>>It is not clear exactly what "IsMember" function you are calling, or how
>>many parameters it may happen to expect. In a logon script environment it
>>typically expects the name of a group, but yours seems to also expect an
>>object variable representing the current user.
>>
>>That said, you are providing three parameters, specfically:
>>
>>parameter one: [objUser]
>>parameter two: ["Product Development" AND objUser]
>>parameter three: ["Fullfillment"]
>>
>>One and three look, at least, like valid parameters (again, we lack
>>sufficient information to determine whether or not they match the
>>expectations of the function), but parameter two is wrong by any stretch
>
> of
>
>>the imagination. The "and" operator can work as either a boolean operator,
>>or a bitwise operator. It does not know how to deal with a string and an
>>(apparent) object.
>>
>>I suspect that what you wanted to do here went like this:
>>
>> if the user is a member of "proddev" and is a member of "fulfil" then
>> map G and I drives as indicated
>> End if
>>
>>Assuming that the IsMember function accepts two parameters, the syntax
>
> would
>
>>be more like this:
>>
>> set WshNetwork = createobject("wscript.network")
>> If IsMember(objUser, "Product Development") _
>> AND IsMember( objUser, "Fullfillment") Then
>> WshNetwork.MapNetworkDrive "G:", "\\Lester\Product"
>> WshNetwork.MapNetworkDrive "I:", "\\Lester\Fullfillment"
>> End If
>>
>>Again, however, this makes certain assumptions about the IsMember
>
> function.
>
>>In addition to that of the parameters is what kind of user object is it
>>(WinNT or LDAP), and does it expect the simple name of the group from
>
> which
>
>>it will deduce the aDSpath or DN.
>>
>>
>>/Al
>>
>>
>>
>>/Al
>>
>>
>
>
>



Relevant Pages

  • Re: Correct Syntax for group membership of two groups
    ... membership for a condition to map the appropriate drives. ... Dim strDriveLetter ... Dim strRemotePath ...
    (microsoft.public.scripting.wsh)
  • Re: vbscripting on windows 2008 active directory
    ... The script works if its run again, after the user logged in the computer. ... However, during logon process, the department network drives do not map, only ... Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path ...
    (microsoft.public.scripting.vbscript)
  • Default password for Active Directory User Script
    ... 'Messages recieved when trying to map a drive ... Dim strUser, strPassword, strDriveLetter, strHomeServer, strProfile ... Dim objDomain, objUser, objGroup ... ' *EnumerateUsers is then called and the AD objects are passed along ...
    (microsoft.public.windows.server.scripting)
  • Re: Graphing Geographic Data
    ... > Dim finalBitMap As Bitmap ... > Dim intHeight As Integer ... I can draw the image on the map ... >> all the dots. ...
    (microsoft.public.dotnet.framework.drawing)
  • WEB Query + IMAGES
    ... Part of the project needs to get a map from multimap and return ... I have written some code that uses a web query to ... obtain a link to the exact postcode location within multi map where the ... Dim postcode ...
    (microsoft.public.excel.programming)