ital_rsx
(Lurker)
2004-08-31 10:50 PM
HELP - Stopping a certain server from running a script

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



ShaneEP
(MM club member)
2004-08-31 11:30 PM
Re: HELP - Stopping a certain server from running a script

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.


NTDOCAdministrator
(KiX Master)
2004-09-01 12:02 AM
Re: HELP - Stopping a certain server from running a script

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



Les
(KiX Master)
2004-09-01 12:19 AM
Re: HELP - Stopping a certain server from running a script

SHane,
You cannot use AND in that situation since it is not possible that @WKSTA be BOTH.

edit: DUH! forget what I said


**DONOTDELETE**
(Lurker)
2004-09-01 06:25 AM
Re: HELP - Stopping a certain server from running a script

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


ShaneEP
(MM club member)
2004-09-01 07:35 AM
Re: HELP - Stopping a certain server from running a script

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.

NTDOCAdministrator
(KiX Master)
2004-09-01 09:07 AM
Re: HELP - Stopping a certain server from running a script

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


ital_rsx
(Lurker)
2004-09-01 08:31 PM
Re: HELP - Stopping a certain server from running a script

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


maciep
(Korg Regular)
2004-09-01 08:58 PM
Re: HELP - Stopping a certain server from running a script

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




ShaneEP
(MM club member)
2004-09-01 09:06 PM
Re: HELP - Stopping a certain server from running a script

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


Les
(KiX Master)
2004-09-01 10:16 PM
Re: HELP - Stopping a certain server from running a script

Why even Split() to make an array?


$SystemList = 'ych-ctrx1','ych-ctrx2','ych-ctrx3'


NTDOCAdministrator
(KiX Master)
2004-09-01 11:46 PM
Re: HELP - Stopping a certain server from running a script

Less typing and looks cooler

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


ital_rsx
(Lurker)
2004-09-02 03:46 AM
Re: HELP - Stopping a certain server from running a script

Thanks Guys

It works great.



puck5151
(Fresh Scripter)
2004-10-11 11:33 PM
Re: HELP - Stopping a certain server from running

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.


Bryce
(KiX Supporter)
2004-10-11 11:38 PM
Re: HELP - Stopping a certain server from running

$systemlist is not anarray, so ascan() will not work on it.

do this...

$SystemList = 'terminalserver',''


puck5151
(Fresh Scripter)
2004-10-12 03:43 PM
Re: HELP - Stopping a certain server from running

That worked perfectly! Thanks Bryce.

puck5151
(Fresh Scripter)
2004-10-15 03:30 PM
Re: HELP - Stopping a certain server from running

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



**DONOTDELETE**
(Lurker)
2004-10-15 05:37 PM
Re: HELP - Stopping a certain server from running

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


ShaneEP
(MM club member)
2004-10-15 05:38 PM
Re: HELP - Stopping a certain server from running

Code:

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



LonkeroAdministrator
(KiX Master Guru)
2004-10-15 05:50 PM
Re: HELP - Stopping a certain server from running

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


Sealeopard
(KiX Master)
2004-10-16 03:14 PM
Re: HELP - Stopping a certain server from running

He's talking about Citrix Metaframe. The question is now, under which computer account is the script actually running? See the FAQ Forum for help on running scripts in Citrix.