Page 2 of 3 <123>
Topic Options
#203940 - 11/12/15 05:13 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=46049&fpart=3
Top
#203941 - 11/12/15 05:24 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
Allen Moderator Online   shocked
KiX Supporter
*****

Registered: 03/04/19
Posts: 4252
Loc: USA
Your link is broke...
Top
#203942 - 11/12/15 05:34 PM Re: Printer mapping script not working in Windows 7 [Re: Allen]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
I am using ComputerInGroup to call the script that does the mapping.

 Code:
if ComputerInGroup('Printer Setup Group')=1
   call @ScriptDir+'\printers.kix'
endif


How do I use ComputerInGroup to enumerate all of the computer's group membership in my script?



http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=46049&fpart=1

Top
#203943 - 11/12/15 05:37 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
Allen Moderator Online   shocked
KiX Supporter
*****

Registered: 03/04/19
Posts: 4252
Loc: USA
I'm headed out... Maybe someone else can hop in here...
Top
#203944 - 11/12/15 05:41 PM Re: Printer mapping script not working in Windows 7 [Re: Allen]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
May have found something to try.

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=201892

Top
#203945 - 11/12/15 05:46 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
Same problem with EnumComputerinGroups. Only enumerates Domain Local groups on Windows 7.
Top
#203947 - 11/12/15 07:25 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
ShaneEP Moderator Online   content
MM club member
*****

Registered: 02/11/29
Posts: 1988
Loc: Tulsa, OK
You mind running a test vb script?

Got it from this sight, which describes some potential errors encountered when using the memberof function, which is what EnumComputerInGroups and ComputerInGroup uses.

http://www.rlmueller.net/MemberOf.htm

Not sure if it's helpful, but it's something.

 Code:
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.computername
Set objUser = GetObject("LDAP://" & strUserDN)
On Error Resume Next
arrGroups = objUser.GetEx("memberOf")
If (Err.Number <> 0) Then
    On Error GoTo 0
    Wscript.Echo "Member of no groups"
Else
    On Error GoTo 0
    For Each strGroup In arrGroups
        Wscript.Echo "Member of group " & strGroup
    Next
End If


Edited by ShaneEP (11/12/15 07:27 PM)
Edit Reason: pasted wrong example...

Top
#203948 - 11/12/15 07:32 PM Re: Printer mapping script not working in Windows 7 [Re: ShaneEP]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
ShaneEP:

Results of script:
ERROR : IDispatch pointers not allowed in expressions!
Script: X:\test.KIX
Line : 2

Top
#203949 - 11/12/15 07:35 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
Oops. Not a kix script.

Running it as a vb yields the domain local groups only.

Top
#203950 - 11/12/15 07:38 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
ShaneEP Moderator Online   content
MM club member
*****

Registered: 02/11/29
Posts: 1988
Loc: Tulsa, OK
Well atleast we know its not a kix issue. Have your tried using WinNT instead of LDAP?
Top
#203951 - 11/12/15 07:42 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
Windows XP returns all groups, domain local and global.
Top
#203952 - 11/12/15 07:46 PM Re: Printer mapping script not working in Windows 7 [Re: ShaneEP]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
This is what I am using:

 Code:
$WS = GetObject('WinNT://' + @domain + '/' + @wksta + '$$')

   for each $grp In $WS.Groups
      $GrpName = $grp.Name

Top
#203953 - 11/12/15 08:02 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
ShaneEP Moderator Online   content
MM club member
*****

Registered: 02/11/29
Posts: 1988
Loc: Tulsa, OK
Oh yeah, sorry I missed that on the first page.

It just doesn't make much sense to me that it worked on XP and not Win7. I'm assuming nothing changed on the server side?


Edited by ShaneEP (11/12/15 08:03 PM)

Top
#203954 - 11/12/15 08:18 PM Re: Printer mapping script not working in Windows 7 [Re: ShaneEP]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
The script has not changed. Two pcs with same group membership.



XP results:
Workstation groups: ITS Computers
Workstation groups: Automatic Updates Computers
Workstation groups: Domain Computers
Workstation groups: Printer Setup Group
Workstation groups: A04_q-mis1
Workstation groups: Windows Updates Computers
Workstation groups: Printer Setup DL Group
Workstation groups: D04_q-mis2

Windows 7 results: (these are all Domain Local groups)
Workstation groups: Domain Computers
Workstation groups: D04_q-mis2
Workstation groups: Printer Setup DL Group

Top
#203956 - 11/12/15 11:28 PM Re: Printer mapping script not working in Windows 7 [Re: tjcarst]
Allen Moderator Online   shocked
KiX Supporter
*****

Registered: 03/04/19
Posts: 4252
Loc: USA
I have not tested this, so there could be an bug or few. Try it out see what you get.

for each $group in GetADComputerGroups()
  ? $group
next
 

function GetADComputerGroups() dim $objSysInfo,$objcomputer,$groups,$group,$array[0],$i $computeringroup=0 $objSysInfo=CreateObject("ADSystemInfo") $objComputer=getobject("LDAP://" + $objSysinfo.computername) $Groups = $objComputer.GetEx("memberOf") for each $group in $groups redim preserve $array[$i] $array[$i]=GetObject("LDAP://" + $Group).cn $i=$i+1 next $GetADComputerGroups=$array endfunction

Top
#203957 - 11/12/16 09:36 PM Re: Printer mapping script not working in Windows 7 [Re: Allen]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
Thank you, Allen.

I am home today fighting a crappy cold. I will test this on Monday and let you know results.

Top
#203958 - 11/12/16 10:58 PM Re: Printer mapping script not working in Windows 7 [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11547
Loc: CA
On XP with Server 2003 AD this comes back empty for me Allen
Top
#203959 - 11/12/16 11:01 PM Re: Printer mapping script not working in Windows 7 [Re: NTDOC]
Allen Moderator Online   shocked
KiX Supporter
*****

Registered: 03/04/19
Posts: 4252
Loc: USA
Just to be sure, you have the computer (not user) in some groups?
Top
#203962 - 11/12/19 08:19 AM Re: Printer mapping script not working in Windows 7 [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11547
Loc: CA
Ah.. didn't even think about that Allen you're probably right. I may not have any stations in groups at this time. I did have at one point but think I've since removed them.

If I have time I'll add some and test it again.

Thanks

Top
#203963 - 11/12/19 05:27 PM Re: Printer mapping script not working in Windows 7 [Re: NTDOC]
tjcarst Offline
Hey THIS is FUN

Registered: 03/09/08
Posts: 243
Loc: Lincoln, NE
GetADComputerGroups on Win7 only retrieves Domain Local Groups too.
Top
Page 2 of 3 <123>


Moderator:  Jochen, Allen, Radimus, Chris S., Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
4 registered (Allen, Mart, ShaneEP, Glenn Barnas) and 152 anonymous users online.
Newest Members
OKCPCS, mprell, Dad24Lads, Cutebear, kstieers
17434 Registered Users

Generated in 0.042 seconds in which 0.01 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org