Morning, I have two files under the user profile which I need to add to a custom rule. I have set up two different types of rules and non are working. Any advice?

ShellCommandTextReturn(cmd.exe /c type %userprofile%\appdata\standard.txt)    No results found after inventory



FileExists(%userprofile%\appdata\standard.txt)        No results found

I have followed the KACE help information but I am not getting results, I have add the file to my PC and I am manually checking in.




1 Comment   [ + ] Show Comment

Comments

  • Just realised KACE runs as system so these variables won't work.
Please log in to comment

Answers

0
As you found, this won't be possible with a custom inventory rule. You can use a script configured to run as the current user that would report back information, or place results in a file that a custom inventory rule can retrieve. 
Answered 08/18/2017 by: chucksteel
Red Belt

Please log in to comment
0
I found this code in an older post a couple of years ago, which I modified based on your question.

The rule will search for the file of logged in users. You can try putting both files into separate ShellCommandTextReturn statements with the AND keyword in between.

If you don't want the logged in users, but instead all profiles then I might be able to modify the rule, but I don't have a Windows system available right now.

ShellCommandTextReturn(cmd /q /c for /f "tokens=2 delims=\" %a in ('wmic computersystem get username') do for %A in (%a) do if exist "C:\Users\%A\AppData\standard.txt" (type "C:\Users\%A\AppData\standard.txt"))
Answered 08/22/2017 by: flip1001
Second Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity