Page 2 of 2 <12
Topic Options
#46954 - 2003-10-22 07:59 PM Re: Enumerating Computer Account Group Membership
Mike Pratt Offline
Fresh Scripter

Registered: 2003-10-17
Posts: 18
Loc: Maine
Hi guys,

I'm taking the IP address right out of the equation...I'm just going to create 4 groups, one for each pod...

I'm going to try TJ's suggestion...I'll let you know the results.. :-)

Thanks for all your help

Top
#46955 - 2003-10-22 08:26 PM Re: Enumerating Computer Account Group Membership
Mike Pratt Offline
Fresh Scripter

Registered: 2003-10-17
Posts: 18
Loc: Maine
Ok, this is what I have for syntax in my kix file:

$pod1ptr="\\server\Pod1"
$pod2ptr="\\server\Pod2"
$pod3ptr="\\server\POD3HPLJ"
$pod4ptr="\\server\HPLJ2100POD4"

call @scriptdir+'\computeringroup.udf'

if ComputerInGroup(Pod1)=1
$nul=AddPrinterConnection(\\server\$pod1ptr)
? "Status - Added printer connection "$pod1ptr
? @serror
$nul=SetDefaultPrinter($pod1ptr)
? "Status - Default printer set "$pod1ptr
endif

Here is the syntax I have in my computeringroup.udf...

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

I am getting an error that says:

error: invalid method/function call: missing ')'!
line: 58

Any ideas?

Top
#46956 - 2003-10-22 08:30 PM Re: Enumerating Computer Account Group Membership
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You're missing quotes all over the place! Please use proper quoting as explained in the KiXtart Manual. Strings MUST be enclosed within quotes and vars should not be used within quotes!
_________________________
There are two types of vessels, submarines and targets.

Top
#46957 - 2003-10-22 08:37 PM Re: Enumerating Computer Account Group Membership
Mike Pratt Offline
Fresh Scripter

Registered: 2003-10-17
Posts: 18
Loc: Maine
Guys! I got it!! Here is the script:

$pod1ptr="\\server\Pod1"
$pod2ptr="\\server\Pod2"
$pod3ptr="\\server\POD3HPLJ"
$pod4ptr="\\server\HPLJ2100POD4"

call @scriptdir+'\computeringroup.udf'

if ComputerInGroup('Pod1')=1
$nul=AddPrinterConnection($pod1ptr)
? "Status - Added printer connection "$pod1ptr
? @serror
$nul=SetDefaultPrinter($pod1ptr)
? "Status - Default printer set "$pod1ptr
endif

if ComputerInGroup('Pod2')=1
$nul=AddPrinterConnection($pod2ptr)
? "Status - Added printer connection "$pod2ptr
? @serror
$nul=SetDefaultPrinter($pod2ptr)
? "Status - Default printer set "$pod2ptr
endif

if ComputerInGroup('Pod3')=1
$nul=AddPrinterConnection($pod3ptr)
? "Status - Added printer connection "$pod3ptr
? @serror
$nul=SetDefaultPrinter($pod3ptr)
? "Status - Default printer set "$pod3ptr
endif

if ComputerInGroup('Pod4')=1
$nul=AddPrinterConnection($pod4ptr)
? "Status - Added printer connection "$pod4ptr
? @serror
$nul=SetDefaultPrinter($pod4ptr)
? "Status - Default printer set "$pod4ptr
endif

Thanks for all your help, this is going to save me a ton of time!

Top
#46958 - 2003-10-23 03:09 AM Re: Enumerating Computer Account Group Membership
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Congrats, Mike [Smile]

I'm happy you were able to get something to work for you!!

tjcarst

Top
#46959 - 2003-10-23 03:12 AM Re: Enumerating Computer Account Group Membership
tjcarst Offline
Hey THIS is FUN

Registered: 2003-09-08
Posts: 243
Loc: USA
Also, if you did not want anything returned to the users, you could remove the lines that start with ? - this is informational only.

tjcarst

Top
#46960 - 2003-10-23 03:13 AM Re: Enumerating Computer Account Group Membership
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If the printer assignments are mutually exclusive, then a SELECT-CASE-ENDSELECT construct is more efficient.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 2 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 581 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.029 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

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