Page 1 of 1 1
Topic Options
#134976 - 2005-03-05 12:14 PM netlogon server
Toga Offline
Fresh Scripter

Registered: 2005-03-03
Posts: 8
I have a script for setting up my printers but I have difference offices with difference printers.
Because each office has another IP range I taught I use that range but it doesn’t work

For example
Code:
  IF IsInIPRange(192.168.30.0)
Deltree ("HKEY_Current_User\printers\connections")
AddPrinterConnection("\\testserver1\CanoniR2.3")
AddPrinterConnection("\\testserver1\HPColorL")
setdefaultprinter("\\testserver1\HP Color LaserJet 4600 PCL 6")
endIF
IF IsInIPRange(192.168.40.0)
Deltree ("HKEY_Current_User\printers\connections")
AddPrinterConnection("\\testserver2\CanoniR2.3")
AddPrinterConnection("\\testserver12\HPColorLa")
setdefaultprinter("\\testserver1\HP Color LaserJet 4600 PCL 6")
endIF



with kind regards,

Tom

Top
#134977 - 2005-03-05 01:29 PM Re: netlogon server
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Don't think you're supplying the correct input parameter, and did you notice the dependencies?


You need these UDFs as well too.

BINARYIP()
ISINSUBNET()

Top
#134978 - 2005-03-05 01:33 PM Re: netlogon server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I assume you are using Jens' UDF. Reading his liner notes, it looks like you are missing the second parm.
Quote:

;SYNTAX ISINIPRANGE(IPADDRESS, IPRANGE)
;
;PARAMETERS IPADDRESS
; Required string containing an ip adress
;
; IPRANGE
; Required string/array of IP ranges (e.g. 10.10.10.0/24)
; Each IP range must be in the format NetworkID/Subnetmask
; Valid formats are aaa.bbb.ccc.ddd/n and aaa.bbb.ccc.ddd/www.xxx.yyy.zzz
;
;RETURNS True if IP address is part of any of the ipranges, otherwise false
;
;REMARKS This function is deprecated in favor of IsInSubnet()




Eh DOC, you piss your bed? Kinda early in the morning for ja.


Edited by Les (2005-03-05 01:36 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
#134979 - 2005-03-05 01:38 PM Re: netlogon server
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Finished up an Xbox party... getting ready for bed soon.
Top
#134980 - 2005-03-05 04:43 PM Re: netlogon server
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
This is more appropriate:
Code:

select
case IsInIPRange(@IPADDRESS0,'192.168.30.0','255.255.255.0')
$server='testserver1'
case IsInIPRange(@IPADDRESS0,'192.168.40.0','255.255.255.0')
$server='testserver2'
caes 1
$server=''
endselect
if $server
$rc=Deltree ('HKEY_Current_User\printers\connections')
$rc=AddPrinterConnection('\\'+$server+'\CanoniR2.3')
$rc=AddPrinterConnection'\\'+$server+'\HPColorLa')
$rc=setdefaultprinter('\\'+$server+'\HP Color LaserJet 4600 PCL 6')
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#134981 - 2005-03-07 09:25 AM Re: netlogon server
Toga Offline
Fresh Scripter

Registered: 2005-03-03
Posts: 8
hello,
the script stops at
Code:

case IsInIPRange(@IPADDRESS0,'192.168.30.0','255.255.255.0')



who can tell me where is goes wrong...
many thx,

Tom

Top
#134982 - 2005-03-07 02:42 PM Re: netlogon server
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Did you read NTDOC's reply about the dependencies? You need the following two UDF's for IsInIPRange() to work.

IsInSubnet

BinaryIP

If you already know that and have included them in your script, then i guess the question is what error are you getting?
_________________________
Eric

Top
#134983 - 2005-03-07 03:56 PM Re: netlogon server
Toga Offline
Fresh Scripter

Registered: 2005-03-03
Posts: 8
I copied the code "isinsubnet" and "binaryIP" in my script but it doesn't work could you send me an example script?

with kind regards,

Tom

Top
#134984 - 2005-03-08 12:41 AM Re: netlogon server
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you would have read the header for IsInIPRange carefully, then you would have noticed that this function has been deprecated in favor of IsInSubnet. Thus, please use IsInSubnet, a UDF that has no dependencies.

You will also need to choose the subnet and subnet masks according to your network requirements.


Edited by sealeopard (2005-03-08 12:43 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#134985 - 2005-06-01 10:01 PM Re: netlogon server
Fabiao Offline
Lurker

Registered: 2005-05-30
Posts: 1
How I make to increase the time of mine script of logon?
Top
#134986 - 2005-06-01 10:46 PM Re: netlogon server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please do not hijaak someone else's topic but rather, start your own. You also may need to elaborate because I for one, haven't a clue what you are asking.
_________________________
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 1 1


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

Who's Online
1 registered (Allen) and 581 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.074 seconds in which 0.037 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