#194304 - 2009-06-18 01:18 AM
jumping sections of a script / excluding workstations
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
I konw there is a much better way to do this but just don't have the experience to know. I'd like to make an exclusion list so I don't run certain parts of my script on specified workstations
IF NOT @WKSTA = "Workstation1" OR "Workstation2" OR "Workstation3" OR "etc" RUN SOME COMMAND ENDIF
|
Top
|
|
|
|
#194306 - 2009-06-18 02:21 AM
Re: jumping sections of a script / excluding workstations
[Re: Allen]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
What if I want to include the computer names within the script?
|
Top
|
|
|
|
#194307 - 2009-06-18 02:31 AM
Re: jumping sections of a script / excluding workstations
[Re: jeff_eisenberg]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
You asked for a better way...
|
Top
|
|
|
|
#194308 - 2009-06-18 02:43 AM
Re: jumping sections of a script / excluding workstations
[Re: Allen]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
So I tried the syntax below but it only seems to register the first entry "Workstation1". Is there some reason the script would not pay attention to the following entries after "Workstation1"? In other words, it runs the command if it is run on Workstation2, 3, etc.
IF NOT @WKSTA = "Workstation1" OR "Workstation2" OR "Workstation3" OR "etc" RUN SOME COMMAND ENDIF
|
Top
|
|
|
|
#194309 - 2009-06-18 02:45 AM
Re: jumping sections of a script / excluding workstations
[Re: Allen]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
Okay... maybe this way then?
Create an INI file and use EnumINI() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=135385
untested:
$excludedcomputers=EnumINI("File.ini")
if ascan($excludedcomputers,@wksta)=-1
;not in the excluded list, so do stuff
else
;found the excluded computer, so skip this section
endif
|
Top
|
|
|
|
#194311 - 2009-06-18 03:03 AM
Re: jumping sections of a script / excluding workstations
[Re: Allen]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
I think this will work... not tested.
if not(@wksta="Workstation1" or @wksta="Workstation2" or @wksta="Workstation3")
;do stuff
endif
I hate this kind of code... my eyes cross and then I question what I did... if its right... Anyone else care to jump in here.
|
Top
|
|
|
|
#194312 - 2009-06-18 06:43 AM
Re: jumping sections of a script / excluding workstations
[Re: Allen]
|
jeff_eisenberg
Fresh Scripter
Registered: 2009-02-26
Posts: 45
Loc: CA
|
Thanks Allen,
As bad as it is, at least I see where my syntax was wrong.
JEff.
|
Top
|
|
|
|
#194313 - 2009-06-18 10:51 AM
Re: jumping sections of a script / excluding workstations
[Re: jeff_eisenberg]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
If you don't want to use external (ini) file then a simpler and more manageable way of implementing exclusion lists is with arrays:
$aExclusionList_1=Split("Workstation1,Workstation2,Workstation3",",")
If 1+AScan($aExclusionList_1,@WKSTA)
"Workstation "+@WKSTA+" is in exclusion list"+@CRLF
Else
"Workstation "+@WKSTA+" is not in exclusion list"+@CRLF
EndIf
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|