/build/static/layout/Breadcrumb_cap_w.png

Systems Management Question


How to add the contents of a file to the Custom Inventory Field.

12/22/2016 2307 views
I need to find all of the laptops in our organization that have an incorrect setting that is controlled by a text entry in a .def file.  I have a .def file located on the HDD at C:\Program Files\Anzio15\RISC1 (VPN).def and I need to get KACE K1000 to read its text and paste the contents under the Custom Inventory Fields of the Device's Inventory. This way I can create a smart filter that will find all of the devices that have "commtype=2" in that file...  

I have tried: going to Inventory>Software>Choose Action>New. Named the new software record, publisher, and version (just make up anything as long as it makes sense to me right?).  About midways down in "Custom Inventory Rule" nothing I have tried works, I entered; 

1. ShellCommandTextReturn(cmd.exe /c type C:\Progra~1\Anzio15\RISC1(~1.def)
2. ShellCommandTextReturn(cmd.exe /c type "C:\Progra~1\Anzio15\RISC1(~1.def")
3. ShellCommandTextReturn(cmd.exe /c type "C:\Progra~1\Anzio15\RISC1(~1.def\")
4. ShellCommandTextReturn(cmd.exe /c type C:\Program Files\Anzio15\RISC1 (VPN).def)
5. ShellCommandTextReturn(cmd.exe /c type "C:Program FIles\Anzio15\RISC1 (VPN).def")
6. ShellCommandTextReturn(cmd.exe /c type "C:Program FIles\Anzio15\RISC1 (VPN).def\")
7. ShellCommandTextReturn(cmd /c type C:Program FIles\Anzio15\RISC1 (VPN).def)
8. ShellCommandTextReturn(cmd /c type "C:Program FIles\Anzio15\RISC1 (VPN).def")
9. ShellCommandTextReturn(cmd /c type "C:Program FIles\Anzio15\RISC1 (VPN).def\")

And probably a few others. Every time I save this software inventory and force the inventory on the laptop next to me, it doesn't add anything to the Devices Inventory under Custom Inventory Rule... If, on the laptop, I open a CMD prompt and enter;

1. cmd /c type "C:Program FIles\Anzio15\RISC1 (VPN).def
2. cmd /c type "C:\Progra~1\Anzio15\RISC1(~1.def)"
3. cmd.exe /c "C:\Progra~1\Anzio15\RISC1(~1.def)"

All print the file onto the screen correctly. 

So what/where is my error here?

Thanks,
1 Comment   [ + ] Show comment

Comments

  • The problem is the parenthesis in the filename. Try adding a backslash before the parenthesis such as

    ShellCommandTextReturn(cmd.exe /c type "C:\Program Files\Anzio15\RISC1 \(VPN\).def")
    or
    ShellCommandTextReturn(cmd.exe /c type "C:\Progra~1\Anzio15\RISC1\(~1")

All Answers

0

I was trying to do exactly the same thing and I have found my mistake.
I did not have select the operating systems when I have created the custom inventory field.



Answered 12/23/2016 by: admama
White Belt

  • That is not my problem, I have all the OS's highlighted blue. It still won't work. Do I need to tag systems to make the software inventory check the computers somehow or is this done automatically when the computers do the inventory check in?
    • the CIR will be run if a check is running.
      In my case I use a similar one:
      ShellCommandTextReturn(cmd /c more c:\programdata\dell\kace\amp.conf|findstr disableloginsplash) (works not with 6.4 since the string is not in the amp.conf of a 6.4 agent but in the amp_auto.conf, but before and also in 7 it is)
      Highlight all OS, set the CIR like that and force a check in.
      If it still don't work:
      enable debug on the agent and run the check in. Check the logs of the agent for error messages. If unsure, post them here or contact support.
      • I tried ShellCommandTextReturn(cmd /c more c:\progra~1\Anzio15\RISC1(~1.def| findstr commtype=) with no luck.

        If I open a cmd prompt and put in "cmd /c more c:\progra~1\Anzio15\RISC1(~1.def| findstr commtype" it returns commtype=X.

        Which logs should I post? Should I post the contents or upload the log somehow?
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ