Kaseya Community

Batch File Scripting output to Custom Field

This question is not answered

Please can someone guide me, this should be very easy for all your gurus.

I am running a simple batch file on a system and need the output to be collected to a custom field I created on the Agent.

I do not see the result as what is produced by the script in the Custom Filed.
The simple batch file is just to collect the shares on the system: net view localhost /all

Thanks

All Replies
  • Hi Heinrvdh;

    You don't need the batch file to execute "net view localhost /all" via an agent procedure, all you need to use is the "executeShellCommand" line to run the command "net view" command. To do this you need to pipe the output to a text file and then read into a variable using the getVariable File Content line. You can also use the "executeShellToVariable" line to do this. The problem that you might run in is that the local shares might be more than one line and the Custom Fields was not really designed store multi line values.

    You actually don't need to use a custom field for the local shares as it is already being audited and can be seen from  "Audit > View Individual Data > Machine Summary", open the "Hardware" tab and you will see the "Disk Shares" sub tab listing all the agents' local shares;


  • Thanks Hardknox

    I now tried to create a new custom field

    Original Install date

    Here is my script , but the custom field is not populated, any idea

    The Custom Field I created , I tried date time, and also string but no luck

    Thanks

  • Set Raid Type Custom Value.xml

    I have a script written that does exactly what you are looking for.
    In it's simplest form these are the steps: (Assumes the custom field 'RaidController' exists)

    1. Sets a variable constant value: "C:\Program Files (x86)\MegaRAID Storage Manager\StorCLI.exe"
    2. Creates a log path, executeshellcommand: "IF not Exist C:\kworking\Scripts\Raid mkdir C:\kworking\Scripts\Raid"
    3. Verifies the service is running, executeshellcommand: "SC qc amService >>#RaidLog_Path#\FujitsuAM.var"
    4. Gets the variable file content: "#RaidLog_Path#\FujitsuAM.var" & store content as "#Fujitsu_amCLI#"
    5. Check the variable content: IfCheckvar "#Fujitsu_amCLI#" contains "AUTO_START"
    6. UpdateSystemInfo with data "Fujitsu_amCLI_MegaRaid"
    7. Cleanup variable files created on system

    The full script functionality is as follows:
    1. Weeds out VM's                            
    2. Determines the raid adapter type (3ware, Fujitsu, LSI, MegaRaid)
    3. Updates the database via a custom field    
    4. Creates the raid log folder
    5. Downloads the correct CLI executable