Page 1 of 2 12>
Topic Options
#125946 - 2004-08-31 10:50 PM HELP - Stopping a certain server from running a script
ital_rsx Offline
Lurker

Registered: 2004-08-31
Posts: 4
Hi!

I a standard Kixtart script which has a command to run the autopcc.exe file for Trend Virus Scan. How can I block this from running on certain servers?

ie.

if server = server name then do not run .. type thing
**
I want all servers to run the following command below EXCEPT for certain servers

use o: "\\ychs2kmanage\officescan"

shell "o:\pccsrv\autopcc.exe"

Any help would be greatly appreciated.

Thanks


Top
#125947 - 2004-08-31 11:30 PM Re: HELP - Stopping a certain server from running a script
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
You mean something like this...?

Code:

If @WkSta <> "MachineNameYouDontWantItToRunOn" and @WkSta <> "AnotherMachineNameYouDontWantItToRunOn"
use o: "\\ychs2kmanage\officescan"
shell "o:\pccsrv\autopcc.exe"
Endif



Please review the manual that comes with the kix download. It contains all of the info you would have needed to accomplish such a simple task. In particular the Macros and If/EndIf sections.

Top
#125948 - 2004-09-01 12:02 AM Re: HELP - Stopping a certain server from running a script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hello Ital_rsx and Welcome to the board.

Well for a simple one with just one or two machines then CitrixMan's code would suffice. If you have more then a few machines then you might want to look at doing something like this, OR reading from an .INI file for a list of computers to ignore.

Code:
$SystemList = Split("server1|server2|server3|server4","|")
If AScan ($SystemList, @WKSTA)>=0
;Do nothing
Else
Use o: /Delete /Persistent
use o: "\\ychs2kmanage\officescan"
shell "o:\pccsrv\autopcc.exe"
EndIf


Top
#125949 - 2004-09-01 12:19 AM Re: HELP - Stopping a certain server from running a script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
SHane,
You cannot use AND in that situation since it is not possible that @WKSTA be BOTH.

edit: DUH! forget what I said


Edited by Les (2004-09-01 12:22 AM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125950 - 2004-09-01 06:25 AM Re: HELP - Stopping a certain server from running a script
Anonymous
Unregistered


Thanks NTDOC.

I addded this to my script and it runs with no errors.

However when I log onto the server in question the autopcc.exe shell still attempts to run.

I understand the AScan function which will scan the systemlist array which then uses @WKSTA as the expression.

Am I missing something else?

Does the command WKSTA not work for Windows 2000 Adavanced Server (Citrix Metaframe) and just run through it but not recognize it?

Thanks

Top
#125951 - 2004-09-01 07:35 AM Re: HELP - Stopping a certain server from running a script
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
the code that doc posted works fine for me using @WkSta. perhaps there is a mis-spelling or missing quote or something in yours. maybe re-post the code exactly as you are trying it so we can have a look if you still cant get it working.
Top
#125952 - 2004-09-01 09:07 AM Re: HELP - Stopping a certain server from running a script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Make sure there are no spaces in your code otherwise a blank on the front or end of the list will not match the server name.

Shouldn't need it here, but there is a UDF to remove blanks from an array as well, but I'd skip it myself and just make sure the typing is correct.

You could also have it show the name of the servers to a DOS console to confirm.

WOW - My 4444 post

Top
#125953 - 2004-09-01 08:31 PM Re: HELP - Stopping a certain server from running a script
ital_rsx Offline
Lurker

Registered: 2004-08-31
Posts: 4
This is the code that I have in the script to do the following:


$SystemList = Split("ych-ctrx1|ych-ctrx2|ych-ctrx3","|")
If AScan ($SystemList, @WKSTA)>=0
;Do nothingElse
Use o: /Delete /Persistent
use o: "\\ychs2kmanage\officescan"
shell "o:\pccsrv\autopcc.exe"
EndIf


Thanks

Top
#125954 - 2004-09-01 08:58 PM Re: HELP - Stopping a certain server from running a script
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Unless it's a typo, the reason it doesn't work is that you have the "Else" keyword commented out.

Code:

$SystemList = Split("ych-ctrx1|ych-ctrx2|ych-ctrx3","|")
If AScan ($SystemList, @WKSTA)>=0
;Do nothing
Else
Use o: /Delete /Persistent
use o: "\\ychs2kmanage\officescan"
shell "o:\pccsrv\autopcc.exe"
EndIf


_________________________
Eric

Top
#125955 - 2004-09-01 09:06 PM Re: HELP - Stopping a certain server from running a script
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Or to simplify it a bit more you can also do...

$SystemList = Split("ych-ctrx1|ych-ctrx2|ych-ctrx3","|")
If AScan ($SystemList, @WKSTA)<0
Use o: /Delete /Persistent
use o: "\\ychs2kmanage\officescan"
shell "o:\pccsrv\autopcc.exe"
EndIf

Top
#125956 - 2004-09-01 10:16 PM Re: HELP - Stopping a certain server from running a script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Why even Split() to make an array?


$SystemList = 'ych-ctrx1','ych-ctrx2','ych-ctrx3'
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125957 - 2004-09-01 11:46 PM Re: HELP - Stopping a certain server from running a script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Less typing and looks cooler

But Les is correct, the Split method is not required.

Top
#125958 - 2004-09-02 03:46 AM Re: HELP - Stopping a certain server from running a script
ital_rsx Offline
Lurker

Registered: 2004-08-31
Posts: 4
Thanks Guys

It works great.


Top
#125959 - 2004-10-11 11:33 PM Re: HELP - Stopping a certain server from running
puck5151 Offline
Fresh Scripter

Registered: 2002-05-08
Posts: 11
Hi, I'm attempting the same thing but it appears the script continues to run on the excluded server...

;terminal server test for tiwsmgr.exe
$SystemList = 'terminalserver'
If AScan ($SystemList, @WKSTA)>=0
;Do nothing
Else
RUN "\\server\tiwsmgr.exe"
EndIf

Any assistance would be greatly appreciated. Thank you.


Edited by puck5151 (2004-10-11 11:35 PM)

Top
#125960 - 2004-10-11 11:38 PM Re: HELP - Stopping a certain server from running
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
$systemlist is not anarray, so ascan() will not work on it.

do this...

$SystemList = 'terminalserver',''

Top
#125961 - 2004-10-12 03:43 PM Re: HELP - Stopping a certain server from running
puck5151 Offline
Fresh Scripter

Registered: 2002-05-08
Posts: 11
That worked perfectly! Thanks Bryce.
Top
#125962 - 2004-10-15 03:30 PM Re: HELP - Stopping a certain server from running
puck5151 Offline
Fresh Scripter

Registered: 2002-05-08
Posts: 11
Hi Bryce, one more question. Is there a way to only run the script if the server name is in the system list? I would assume changing the end of the ascan from a 0 to a 1 would do the trick but not certain if this is correct.

If AScan ($SystemList, @WKSTA)>=1


Top
#125963 - 2004-10-15 05:37 PM Re: HELP - Stopping a certain server from running
Anonymous
Unregistered


Ok, I figured this one out. I just changed the variable at the end of the command...

FROM:
If AScan ($SystemList, @WKSTA)>=0

TO:
If AScan ($SystemList, @WKSTA)<>0

Top
#125964 - 2004-10-15 05:38 PM Re: HELP - Stopping a certain server from running
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Code:

;terminal server test for tiwsmgr.exe
$SystemList = 'terminalserver',''
If AScan ($SystemList, @WKSTA)>=0
RUN "\\server\tiwsmgr.exe"
EndIf


Top
#125965 - 2004-10-15 05:50 PM Re: HELP - Stopping a certain server from running
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if the item is not in the array, it will return -1.
thus, simply using:
If AScan ($SystemList, @WKSTA)>=0

or:
If AScan ($SystemList, @WKSTA)>-1
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.057 seconds in which 0.02 seconds were spent on a total of 13 queries. Zlib compression enabled.

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