[Solved] Function IP address

Antworten
nirale33
Beiträge: 28
Registriert: 13 Sep 2013, 09:29

[Solved] Function IP address

Beitrag von nirale33 »

HI Everyone,

I want to create an installation rule based on the IP address of the machine for put a different CD key for each society.

Is there a method to retrieve the IP in a variable so you can call after?

Thx

Regards,
Zuletzt geändert von nirale33 am 31 Jan 2014, 15:42, insgesamt 1-mal geändert.
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3327
Registriert: 04 Jun 2008, 14:27

Re: Function IP address

Beitrag von d.oertel »

HI,

opsi-winst knows the constant
%IPAddress%
and the Functions:
getMyIpByTarget
and
GetIpByName

Often is this the best way:

Code: Alles auswählen

set $CompValue$ = getMyIpByTarget("%opsiServer%")
gives you the IP of the Interface that is used to communicate with the opsi server.

see:
download.uib.de/opsi_stable/doc/html/en ... anual.html

regards

d.oertel


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


nirale33
Beiträge: 28
Registriert: 13 Sep 2013, 09:29

Re: Function IP address

Beitrag von nirale33 »

Thx for your reply

I'm almost there, but I've a problème, I want "cut" my IP for select only the second byte.

There are many subnet (10.78.*.* , 10.80.*.* ...) and one licence key for each subnet.

IP client : 10.78.1.5
I want to compare the second byte with some I've already filled at the beginning of my script.

My script is :

Code: Alles auswählen

[Actions]

Message "F-Secure setup"
SetLogLevel=6

DefVar $IPAddress$
DefVar $IPpart$
DefVar $Ent1$
DefVar $IPtotal$

Set $IPtotal$=$IPAddress$
[color=#FF0000]Set $IPpart$=getSubList(3: 2, $IPtotal$)[/color]
Set $Ent1$="87"

if ($IPpart$ =$Ent1$)
	sub_install
else
	stop "Failled"
endif

The red part returns an error
nirale33
Beiträge: 28
Registriert: 13 Sep 2013, 09:29

Re: Function IP address

Beitrag von nirale33 »

Yeah it works with this script.

Now I can attribute an CD key for each society :D

Code: Alles auswählen

[Actions]

Message "F-Secure setup"
SetLogLevel=6


DefVar $CompValue$
DefVar $Ent1$

set $CompValue$=getMyIpByTarget("%opsiServer%") > Find the computer IP address
Set $Ent1$="87" > We are in A class IP (10.87.*.*)

if contains($CompValue$, $Ent1$) > Find if in my IP there is the number 87
	
	sub_install
else
	stop "Failled"
endif
Antworten