Sometimes is necessary to reconfigure the scheduled job of the Inventory Scan (LDISCN32.EXE) to all our machines, or a group of them to add for example a switch.
Usually to reconfigure the Inventory Scan job it is better to act through the GUI of the LANDesk 32-bit Console (Agent Configurations) and then update the Agent Configuration through the console but in some particular case this is not possible.
For example if we want to add the /NH parameter (no hardware scan) to the Inventory Scan command line the only way is to act manually.
The challenge is to modify the job of the LANDesk Local Scheduler (LocalSched.exe) but the main problem is to determine where is the agent directory:
On 32 bit OS generally is C:\Program Files\LANDesk\LDClient\ but on 64bit OS it is C:\Program Files (x86)\LANDesk\LDClient\
And what about if the location of the agent, for some strange configuration requirements, is not the standard one?
Is it possible to write a single script that can work on all the machines (Windows) regardless the architecture and/or strange configurations?
Yes it is possible to write a one line script that will be able to reconfigure all your Windows devices regardless their architecture or particular customization.
The MS-DOS batch need to contain this line:
"%LDMS_LOCAL_DIR%\..\localsch.exe" /taskid=777 /cmd="/NTT=coreen:5007 /S=coreen /I=HTTP://coreen/ldlogon/ldappl3.ldz /NOUI /NH" /exe="%LDMS_LOCAL_DIR%\..\LDISCN32.EXE" /autodelay="0|60"
a more elegant variation (that assumes that the DATA subdirectory of the LDCLIENT folder is really called DATA is the following
"%LDMS_LOCAL_DIR:data=%\localsch.exe" /taskid=777 /cmd="/NTT=coreen:5007 /S=coreen /I=HTTP://coreen/ldlogon/ldappl3.ldz /NOUI /NH" /exe="%LDMS_LOCAL_DIR:data=%\LDISCN32.EXE" /autodelay="0|60"
The only thing that you need to change in this one line script is the core server name that in this example is coreen
For definition all the TASK IDs of the LANDesk Local Scheduler below 1000 are reserved and generally the Task ID 777 is associated to the Inventory Scanner scheduled task.
Before to massively deploy this script on all your devices is better to make a check is some "creative" administrator changed this normal behavior So you need to check that the Task ID 777 is really referencing to the Inventory Scan (LDISCN32.EXE).
To make this check is very simple. You only need to issue the following command:
LocalSch /tasks | more
The exit code for the script will not be 0 so the LANDesk Scheduler will suppose that the script failed.
The return code for localsch.exe is the Task ID number that you modified so in this case will be 777.
You can take advantage of the Return Code Template feature to create a new template (suggested) or add to the default one the return code 777 as succesfull (quick & dirty).