|
|
|||||||
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? |
||||||||
|
|
|||||||
I don't get it, why do you wanna do that? |
||||||||
|
|
|||||||
Yes, it is possible but not with InGroup(). You can find a UDF in our library. |
||||||||
|
|
|||||||
ComputerInGroup() |
||||||||
|
|
|||||||
is this possible? If ComputerInGroup($t202) use t: "\\tessende-llser\wintoets" /PERSISTENT Endif thx |
||||||||
|
|
|||||||
what is $t202? a computer or group? |
||||||||
|
|
|||||||
t202 is a group |
||||||||
|
|
|||||||
Quote: Yes, but why persistent? |
||||||||
|
|
|||||||
I think it should be Code:
|
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
T202 is a group, and persistent is added by the kixstarter script editor, i try If ComputerInGroup('t202') but dit doesn't work. Tiswa |
||||||||
|
|
|||||||
Why don't you post all of the code so that we can see the logical flow process. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
Have you logged off and back on after adding your test user to this group? |
||||||||
|
|
|||||||
Where and how to you define the function? What version @KiX? |
||||||||
|
|
|||||||
Good question Les. If this is all the code, the UDF is definitely missing. |
||||||||
|
|
|||||||
ComputerInGroup() - returns if the PC is a member of a specified group |
||||||||
|
|
|||||||
It needs to be done like this.... Code:
If you don't add the function in the code, then it has nothing to reference against, and it wont work. |
||||||||
|
|
|||||||
You are missing quotes. Assuming of course that 't202' is the computer's NetBIOS name. If ComputerInGroup('t202') |
||||||||
|
|
|||||||
[edit][delete]Cut[/delete] Copy[/edit] and paste, gets you everytime. Better? |
||||||||
|
|
|||||||
Quote: For me, Cut is greyed out. |
||||||||
|
|
|||||||
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 this work perfect Thanks |
||||||||
|
|
|||||||
Quote: I don't see how that can work. It should give you an error. The group name should be within quotes If ComputerInGroup("t202") |
||||||||
|
|
|||||||
you are right but kixstarter give's no error |
||||||||
|
|
|||||||
Quote: Depends. KiXtart will treat unrecognised text as a string in most circumstances with older versions of KiXtart. I think that the latest versions will always produce a runtime error. |