I'm trying to create a custom inventory rule to display the contents of %LOCALAPPDATA%\Microsoft\Outlook. The problem that I am finding is that it is running as the KACE system process and doesn't display the correct information. Any ideas on this one? 

Here is my command: ShellCommandTextReturn(cmd /c dir %LOCALAPPDATA%\Microsoft\Outlook)
1 Comment   [ + ] Show Comment


  • CIR's run as system that is why you have problems getting the logged in users info
Please log in to comment


I would recommend creating a script that detects the current logged in user and gathers the data you want then outputs it. You can then have your custom inventory rule run that script. This code will create a user variable for the current logged in user:
for /f "tokens=8" %%a in ('tasklist /v ^|find "explorer.exe"') do (
set "user=%%a")

One caution: If a machine runs an inventory update when a user isn't logged into a computer then this won't return any results and that would interfere with the collection of your data.

Answered 05/09/2016 by: chucksteel
Red Belt

Please log in to comment
you can modify this blogs commands to to a dir instead of a DO net localgroup


DO dir C:\Users\%%g\AppData\Local\Microsoft\Outlook
Answered 05/09/2016 by: SMal.tmcc
Red Belt

Please log in to comment
Try this for a CIR, but it will only work if a domain account is in session as far as I can tell.

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\Local\Microsoft\Outlook\." (dir "C:\Users\%A\AppData\Local\Microsoft\Outlook"))

Answered 05/09/2016 by: flip1001
Third Degree Green Belt

Please log in to comment
There is an extra \M in what you posted as your command. Is that a typo in your post or is that how you have the CIR?
Answered 05/06/2016 by: rockhead44
Tenth Degree Black Belt

  • err thanks for pointing that out. It was just a typo in my post.
Please log in to comment
Answer this question or Comment on this question for clarity