Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Problem with group membership check, parsing array information

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,57283
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with group membership check, parsing array information
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Problem with group membership check, parsing array info... - 2/29/2008 7:24:49 AM   
  Julian


Posts: 2
Score: 0
Joined: 2/29/2008
Status: offline
Hello gurus. I'm having some problems with this script that I've built, combining elements from others in use at my organisation. The goal is to check a users group memberships (could include some nested) and map network printers based on those memberships. I also intend on using a similar method to map network drives.

The error I'm receiving is a runtime error, variable is undefined: 'IsMember'. I'm pretty sure the problem is because of a LDAP/WinNT provider mix-up but with my limited knowledge, I can't figure out what I need to change. I've search for IsMember examples throughout the site and have been unable to find any threads with IsMember linked to arrays in this manner.

Any pointers? Thanks in advance for any assistance you may be able to give me.



Julian

////////////////////////////////

Option Explicit
Dim objNetwork
Dim objSysInfo
Dim strUserPath
Dim objUser

Private Const P_PRINTER_PATH = 0
Private Const P_GROUP_NAME = 1
Private astrNetworkPrinterList()
FillNetworkPrinters
      'WScript.Echo "Done filling Network Printers Array"
Sub FillNetworkPrinters
  ReDim astrNetworkPrinterList(P_GROUP_NAME,2)
  astrNetworkPrinterList(P_PRINTER_PATH, 0) = "\\deathstar.empire.root.local\Darth_Pink"
  astrNetworkPrinterList(P_GROUP_NAME, 0) = "deathstarDarth_Pink_P"
  astrNetworkPrinterList(P_PRINTER_PATH, 1) = "\\deathstar.empire.root.local\Darth_Blue"
  astrNetworkPrinterList(P_GROUP_NAME, 1) = "deathstarDarth_Blue_P"
  astrNetworkPrinterList(P_PRINTER_PATH, 2) = "\\deathstar.empire.root.local\Darth_Brown"
  astrNetworkPrinterList(P_GROUP_NAME, 2) = "deathstarDarth_Brown_P"
End Sub

' ***************** Script Begins *****************
Set objNetwork = CreateObject("Wscript.Network")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserPath = "LDAP://" & objSysInfo.userName
Set objUser = GetObject(strUserPath)

' Add a printer connection if the user is a member of the group.
    'WScript.Echo "Beginning of Printers Loop"
Dim strPGroupName, strPPrinterPath
Dim lngP_Index, lngP_UBound
lngP_UBound = UBound(astrNetworkPrinterList, 2)
For lngP_Index = 0 to lngP_UBound
    'WScript.Echo "Index is " & lngP_Index
  strPGroupName = astrNetworkPrinterList(P_GROUP_NAME, lngP_Index)
  strPPrinterPath = astrNetworkPrinterList(P_PRINTER_PATH, lngP_Index)
  If IsMember(objUser, strPGroupName) Then
    On Error Resume Next
    objNetwork.AddWindowsPrinterConnection strPPrinterPath
    On Error GoTo 0
  End If
Next

////////////////////////////////
 
 
Post #: 1
 
 RE: Problem with group membership check, parsing array ... - 2/29/2008 9:32:34 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
It appears IsMember might have been a custom Sub/Function....where did you get that part of the script from...you may want to start there.

WinNT has a method IsMember, but it is not used the same way you appear to be using IsMember which is why I said it looks like a custom sub/function.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Julian)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with group membership check, parsing array information Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts