Page 1 of 2 12>
Topic Options
#160425 - 2006-04-06 02:51 PM Do if workstation is in group
casperinmd Offline
Fresh Scripter

Registered: 2005-03-03
Posts: 9
Greetings,
I am trying to setup my script to map a PC to a network printer based on the computers group membership.

I have tried If INGROUP but that does not work, it only seems to work if the user is in the group.

Is this possible?

Top
#160426 - 2006-04-06 02:59 PM Re: Do if workstation is in group
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I don't get it, why do you wanna do that?
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#160427 - 2006-04-06 03:05 PM Re: Do if workstation is in group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, it is possible but not with InGroup(). You can find a UDF in our library.

Edited by Les (2006-04-06 03:06 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#160428 - 2006-04-06 04:34 PM Re: Do if workstation is in group
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
ComputerInGroup()
Top
#160429 - 2006-04-10 12:17 PM Re: Do if workstation is in group
Tiswa Offline
Fresh Scripter

Registered: 2006-04-10
Posts: 6
is this possible?

If ComputerInGroup($t202)
use t: "\\tessende-llser\wintoets" /PERSISTENT
Endif

thx

Top
#160430 - 2006-04-10 12:30 PM Re: Do if workstation is in group
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
what is $t202? a computer or group?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#160431 - 2006-04-10 12:42 PM Re: Do if workstation is in group
Tiswa Offline
Fresh Scripter

Registered: 2006-04-10
Posts: 6
t202 is a group
Top
#160432 - 2006-04-10 03:03 PM Re: Do if workstation is in group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

is this possible?




Yes, but why persistent?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#160433 - 2006-04-10 09:10 PM Re: Do if workstation is in group
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I think it should be
Code:

If ComputerInGroup('t202')


Top
#160434 - 2006-04-10 09:16 PM Re: Do if workstation is in group
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
It all depends on the question if the group name is $t202 or that it is a var that gets filled somewhere with the name of the group.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#160435 - 2006-04-11 07:37 AM Re: Do if workstation is in group
Tiswa Offline
Fresh Scripter

Registered: 2006-04-10
Posts: 6
T202 is a group, and persistent is added by the kixstarter script editor, i try If ComputerInGroup('t202') but dit doesn't work.

Tiswa

Top
#160436 - 2006-04-11 08:02 AM Re: Do if workstation is in group
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Why don't you post all of the code so that we can see the logical flow process.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#160437 - 2006-04-11 02:13 PM Re: Do if workstation is in group
Tiswa Offline
Fresh Scripter

Registered: 2006-04-10
Posts: 6
This is all of it

If ComputerInGroup($t202)
use t: "\\tessende-llser\wintoets" /PERSISTENT
Endif

i also try

If ComputerInGroup(t202)
use t: "\\tessende-llser\wintoets"
Endif

Top
#160438 - 2006-04-11 02:19 PM Re: Do if workstation is in group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
In your first sample, why do you have a variable "$t202" as the name of the group? In the second sample, why is there no quotes around your string "t202"? Have you tried InGroup("domain\group")? I would recommend against using the /Persistent switch.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#160439 - 2006-04-11 02:21 PM Re: Do if workstation is in group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Have you logged off and back on after adding your test user to this group?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#160440 - 2006-04-11 02:37 PM Re: Do if workstation is in group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Where and how to you define the function? What version @KiX?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#160441 - 2006-04-11 02:53 PM Re: Do if workstation is in group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Good question Les. If this is all the code, the UDF is definitely missing.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#160442 - 2006-04-11 03:01 PM Re: Do if workstation is in group
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
ComputerInGroup() - returns if the PC is a member of a specified group
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#160443 - 2006-04-11 03:09 PM Re: Do if workstation is in group
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
It needs to be done like this....

Code:

If ComputerInGroup(t202)
use t: "\\tessende-llser\wintoets"
Endif


Function ComputerInGroup($group,optional $Domain)
Dim $oGrp
if not $domain $domain=@domain endif
$oGrp = GetObject("WinNT://" + $domain + "/" + $group + ",group" )
if @error exit 1 endif

if $oGrp.IsMember("WinNT://" + $domain + "/" + @wksta + "$$" )
$ComputerInGroup=1
else
$ComputerInGroup=0
endif
endfunction



If you don't add the function in the code, then it has nothing to reference against, and it wont work.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#160444 - 2006-04-11 03:27 PM Re: Do if workstation is in group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You are missing quotes. Assuming of course that 't202' is the computer's NetBIOS name.
If ComputerInGroup('t202')
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.071 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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