Video Screencast Help

How to create a server task that uses a list of computers on CMS7.1

Created: 11 Aug 2014 • Updated: 11 Aug 2014 | 7 comments


I need to run a script on a "couple" of computers. The problem is that these computers don't have the altiris agent running correctly.

I'd like to, instead of assigning a script task to a filter and have each of the computers in the filter run the task, have the NS run the script once for each of the computers in the filter, using the target computername as a variable.

Sounds simple enough for me, but I cant figure it out...

I tried creating a "run script on Server" task and then create a token from the appropriate query, but then I can't use it for anything useful (because it has multiple lines)

The script Im trying to run is very simple (deletes files from %tempfolder% and other space hogs, psexec to restart altiris agent)

Any ideas?

Operating Systems:

Comments 7 CommentsJump to latest comment

andykn101's picture

I'm not sure but I think you need to use a "Run Script on Task Server" task, I've not been able to get the "Run Script on Server" type task to run with Tokens but I think I did get ot to work with the task server one.

Authorised Symantec Consultant (ASC) with Endpoint Management Limited, an Authorised Symantec Delivery Provider based in the UK.

Connect Etiquette: Please "Mark as Solution" posts that fix your problem.

Asmodaeus's picture

The "run script on task server" won't help me, because the problem is the same:

How do I pass the computer list to the script, and handle it ithin the script?

JoeVan's picture

I think you are over-complicating this by trying to run a job in Altiris to fix this.  If the Altiris agent is not functional, you should just create a stand-alone script that will connect to each machine and do what you need to do.

Below is an example set of 3 scripts you can use to accomplish this.  Tip:  A quick way to create the first script is export the list of machines into Excel then add a column A with "Call FixMachine.bat ".  Now just paste column A & B into a text file. Modify FixMachine.bat to include whatever steps you want for each machine.  Once you create all three scripts, run fixlist.bat.

@echo off
Call FixMachine.bat Machine1
Call FixMachine.bat Machine2
Call FixMachine.bat Machine3
Call FixMachine.bat Machine4
Call FixMachine.bat Machine5
Call FixMachine.bat Machine6

@echo off
REM Used to delete temp files and restart the Altiris NS agent on a remote machine
Echo Deleting Temp Files....
DEL /S /Q C:\Temp\StuffIDontWant\*.*
Echo Stopping AeXNSClient
sc \\%1% stop aexnsclient
Echo Please Wait.....
wscript sleep.vbs
Echo Starting AeXNSClient
sc \\%1% start aexnsclient
Echo Please Wait.....

' Pause for 13 seconds
wscript.sleep(13 * 1000)

Joe VanHollebeke
Systems Engineer

Asmodaeus's picture

Well of course I can do that.

As a matter of fact I already did.

The goal here is to have an automatic system (enter Altiris) to do it, and have the list of computers automatically updated.

Also, since Altiris is managing the computer list and is able to run scripts on the server it seemed to me like the perfect choice.



Igor Perevozchikov's picture

Just about another part of problem

In case if you know that some clients have Agent, which is running not correctly, why don't you just perform re-installation of agent from SMP Console by push method and then schedule required client task?

  • Add problematic client PC in SMA push grid and initiate re-installation of agent


  1. Don't forget that, first you can find an answer for your question in Knowledge base
  2. If answer solves your question, then please mark as solution to close a thread
Asmodaeus's picture

I obviously have the SMA install policy active.

I'm trying to solve problems on a bunch of computers that eiher can't install the agent or can't run the agent correctly due to not enough hdd space.



sfaucher's picture

The 'run script on task server' task is what you want. It differs from the 'run script on server' task in that it can be scheduled on target computers even though it actually runs on the task server associated with the target. It doesn't require the target computer actually be communicating correctly with the NS since it runs on the task server, yet it still will reference tokens in respect to the target computer, not the task server. You'll schedule the task with the filter as the target and I would assume set it to repeat so it runs automatically at whatever period you desire. The script itself would then only need to be designed to affect a single computer, using the %COMPNAME% token to reference it. No need to make your single script run once and iterate over the list of computers when it can just run multiple times, once for each computer in the filter.

Shawn Faucher | Senior Technology Analyst

Armstrong Teasdale LLP