Page 1 of 1 1
Topic Options
#64891 - 2002-04-25 06:40 PM bypass servers script help
chuckles Offline
Fresh Scripter

Registered: 2001-12-07
Posts: 27
Loc: new york
Hi, below is my script that i need some help. I'm trying to make a list of all servers that if it matches one of these servers then GO TO the end (:nothing)

seems if i do:
if @wksta = "server1" this works ok..but i need to make a list of servers. any help is appreciated THANKS!

$bypass="'server1' 'server2' 'server3'"

If @wksta = "$bypass"
Gosub nothing
Else
Gosub addmaps
Gosub schtask

Top
#64892 - 2002-04-25 06:59 PM Re: bypass servers script help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Gee... tough way to do it.
If you have KiX4 then @ProductSuite is your friend.

Else
code:
;  - check OS WinNT = 1, Win95 = 2
;
if @INWIN = 2
goto OSRightsOK
endif
; not Win95, ergo must be WinNT so more checks are in order
;-----------------------------------------------------------------------------------
; - check if logon to Server or Workstation
; PRODUCTTYPE - WinNT = Workstation, ServerNT = Member Server, LanmanNT = Domain Controller
;
$PRODUCTTYPE = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS","PRODUCTTYPE")
; if not Workstation, just exit without notice
if $PRODUCTTYPE <> "WinNT"
goto finish
ENDIF

EndIf

[ 25 April 2002, 19:00: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64893 - 2002-04-25 07:03 PM Re: bypass servers script help
chuckles Offline
Fresh Scripter

Registered: 2001-12-07
Posts: 27
Loc: new york
Thanks for trying to help. Actually i'm not trying to do a OS CHECK. It is more of a COMPUTERNAME Check thats why i'm using @WKSTA. Need a way to add a list of servernames and compare that.

btw i am using 4.02

Thanks!

Top
#64894 - 2002-04-25 07:07 PM Re: bypass servers script help
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Chuckles, are you saying that you want to run the script on some servers but not others?

[ 25 April 2002, 19:07: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#64895 - 2002-04-25 07:27 PM Re: bypass servers script help
chuckles Offline
Fresh Scripter

Registered: 2001-12-07
Posts: 27
Loc: new york
yup basically if i use myloginname: charles it will execute my loginscript on ANY MACHINES. What happens is if i login to one of my SERVERS it will execute the SAME loginscript. so to remedy the problem i add if statement that if @WKSTA = "server1" then goto end this will bypass the loginscript.
this works fine with one server "server1" but i need to make a LIST of servers that if it belongs to this list then GOTO END.

so i need something like this
$bypasslist = "'servertest', 'server2test', 'test3'"
If @WKSTA = "$bypasslist"
gosub END

Top
#64896 - 2002-04-25 07:33 PM Re: bypass servers script help
Jake Offline
Fresh Scripter

Registered: 2001-11-14
Posts: 26
you can do it like this:
code:
If @wksta="name1" OR @wksta="name2" 
goto end
else
"do whatever"
endif


Top
#64897 - 2002-04-25 07:41 PM Re: bypass servers script help
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
You can copy a check file to the %windir% directory on your servers you want in this list (Ex. C:\winnt\checkfile.chk)
This is suggested that you only want this to run on servers using 4.0 of kix or higher...

code:
 
IF INSTR("@PRODUCTTYPE","Server") <> 0 or INSTR("@PRODUCTTYPE","Controller") <> 0
SELECT
CASE @USERID <> "Charles" and EXIST("%WINDIR%\CHECKFILE.CHK") = 0
RUN LOGONSCRIPT FOR CHARLES
CASE @USERID <> "Charles" and EXIST("%WINDIR%\CHECKFILE.CHK") = 1
GOTO THEEND
CASE EXIST("%WINDIR%\CHECKFILE.CHK") = 1
GOTO THEEND
CASE EXIST("%WINDIR%\CHECKFILE.CHK") = 0
RUN REGULAR LOGON SCRIPT
CASE 1
ENDSELECT
ENDIF

....

:THEEND

L8tr... [Big Grin]

Top
#64898 - 2002-04-25 07:53 PM Re: bypass servers script help
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
The idea of a file to check works well..
But...

Where I work, noone logs onto servers as anything but administrator of a domain or of a machine. ALL other work is done on workstations (especially browsing the internet, word processing apps, email, etc.) Using this policy keeps our servers free from excessive junk files and security problems (see Microsoft's frequent security bulletins).

A simple rule: Unless the task is a direct operation on server functions, it probably shouldn't be done at a server console.

Brian

Top
#64899 - 2002-04-25 07:54 PM Re: bypass servers script help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
With the exception of my terminal server, I don't run logon scripts on any servers whatsoever. So ProductSuite does the trick.

Why can you not use the same logic? Are there some servers you do want a logon scrit to run on?

[ 25 April 2002, 19:54: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64900 - 2002-04-25 08:09 PM Re: bypass servers script help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
chuckles ,

in order to get your first idea to work, use instr() instead :

code:
$bypass = "Server1,Server2,etc"

if instr($bypass,@wksta)
quit()
endif

hth

Jochen
_________________________



Top
#64901 - 2002-04-25 08:14 PM Re: bypass servers script help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
I like Jochen's method.

Quick clean code.

You could also use SELECT CASE statements for determination. That way you could chose which portion (if any) of the script you do want to run on any specific server and bail out on the others.

Top
#64902 - 2002-04-25 10:05 PM Re: bypass servers script help
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why not create an array of names and do an ISINARRAY() check. ISINARRAY can be found in the UDF section.
code:
$array='comp1,comp2,comp3'
$array=split($array,',')
if ISInArray('comp1',$array)
; do stuff
endif

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

Top
#64903 - 2002-04-25 11:23 PM Re: bypass servers script help
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Jens,

Chuckles did not mention what version of KiX he is using.

and yeah... there are many, many ways to do this. Jochen's idea though will work on all versions of KiX and is very small and manageable without all the other fluff of a larger script.

Top
#64904 - 2002-04-27 12:18 AM Re: bypass servers script help
jprompt Offline
Lurker

Registered: 2002-04-26
Posts: 2
Loc: paris
$Srvlist = "'server01' 'server02' 'server03'"
IF InStrRev( $Srvlist , @WKSTA )
? "Vous êtes sur un serveur"
ENDIF

Top
#64905 - 2002-04-28 03:28 PM Re: bypass servers script help
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

With the clear and fast solution there is only a problem when
workstattion names are f.e. server01 & server011.
To solve this we suggest following code
code:
 $srvlist="-server01-server011-server02-server022-"
IF (Instr($srvlist,"-"+@wksta+"-") <> 0)
GOTO next
ELSE
GOSUB addmaps
GOSUB schtask
ENDIF
:next

Above code works for kixtart 3.x and 4.x releases.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#64906 - 2002-04-29 09:46 AM Re: bypass servers script help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Good point MCA !

Greetz
Jochen
_________________________



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
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.199 seconds in which 0.113 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