/build/static/layout/Breadcrumb_cap_w.png

Custom Inventory - ShellCommandTextReturn does not work

Ok, I have created some vbscripts to search for file types PST, MDB & XLA files which report back as a String, the file paths, names and sizes. The script works perfectly.

So I distrbuted the scripts using KACE Scripting feature and have the folder numbers used in the KBOX cache stored in the All User/ProgramData folders.

I have then added the Software with custom inventory rules as below:-

ShellCommandTextReturn(cscript.exe /nologo "C:\Documents and Settings\All Users\Dell\KACE\kbots_cache\packages\kbots\137\FindMDBFiles.vbs")

This DOES NOT WORK! The same command editing for Windows 7 profile structure works perferctly as below:-

ShellCommandTextReturn(cscript.exe /nologo "C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\137\FindMDBFiles.vbs")

The only difference is spaces in the folder structure.

Any ideas?

I understand that KACE cannot nest KBOX functions and also doesn't support Windows Environment Variables either.


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: chucksteel 12 years ago
Red Belt
2

You have to escape the quotes with a backslash:

ShellCommandTextReturn(cscript.exe /nologo \"C:\Documents and Settings\All Users\Dell\KACE\kbots_cache\packages\kbots\137\FindMDBFiles.vbs\")

Support gave me this solution when I submitted a ticket for a similar issue.


Comments:
  • great stuff, I would have preferred to use the escape the quotes solution, would be nice if they documented this stuff!

    Instead i created a ZIP file containing my scripts and used a scripting task to extract the zip file to C:\Windows\KACE.

    I'll probably re-work this to use the escape quotes solution. - Geedoubleu 12 years ago
  • Using Agent 5.3.53177 this doesn't work for me, in the debug log I also see it interpretting the "and" in "Documents and Settings" as a LOGICAL AND, so splits it into two rules... this is quite annoying. The workaround in the end by support was to use DOS 8 character representation for the path, so C:\Docume~1\AllUse~1\Dell\KACE\etc lets hope you never have to use a path with "OR" or "AND" in the first 6 characters of a folder name! - AJStevens 12 years ago
Posted by: Geedoubleu 12 years ago
Senior Yellow Belt
1

I can make this run on Windows XP by copying the vbscripts to C:\Windows\KACE and then it works perfectly.

The only conclusion I have is that the ShellCommandTextReturn(command) cannot handle spaces in the command and does not respect " " as you would normally use in Windows.

I've now got to work out how to copy these scripts to C:\Windows\KACE with-out flashing up a DOS prompt on everyones computers.

I've never known a product with so many un-documented nuances!

 


Comments:
  • Use http://www.f2ko.de/programs.php?lang=en&pid=b2e to stop the CMD prompt. It has helped me. - dugullett 12 years ago
  • Excellent tool, thanks for sharing!

    John - jverbosk 12 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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