/build/static/layout/Breadcrumb_cap_w.png

Custom inventory Rule Query

Hi

Is it possible to create a custom inventory field which contains the contents of a file?
I have done this with a registry value using - RegistryValueReturn()

Is there a similiar command for text files, the file would only contain a single line of text.

Thanks

0 Comments   [ + ] Show comments

Answers (5)

Posted by: rmeyer 12 years ago
Second Degree Blue Belt
3
you can find the enviroment variables in here via registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

*edit* this is only system enviroment variables, not user, also remember the agent runs as SYSTEM, not the logged on user that could be why it won't return %USERNAME% *edit*
Posted by: dchristian 12 years ago
Red Belt
0
Try this:
ShellCommandTextReturn(cmd.exe /c type C:\yourfile.txt)
Posted by: PG_t4ttyt3ddy 12 years ago
Senior Yellow Belt
0
Hi

Thanks for a speedy response. That would work a treat, only I have since realised that the file I wish to see resides in the APPDATA directory of the users directory, and unfortunately the environment variable %username% won't work. Does anyone know a way around the environment variable issue, or when KACE plan to allow the usage of env variables in a custom inventory rule.

Thanks
Posted by: ms01ak 12 years ago
10th Degree Black Belt
0
You could write a script that runs under that user's account (the script has to be an online kscript and run as user logged in to console) and copies the files to another location on the c drive or just upload the file right into kace in the script.
Posted by: snissen 12 years ago
Fourth Degree Green Belt
0
You are correct in saying that Windows environment variables are not supported in custom inventory rules.

However, I find some of them work sometimes anyway.[:)] Sande
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

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