FileInfoReturn Custom Inventory property for Current User
I am trying to find the date of a file un the currently logged in users %%APPDATA% folder using a Custom Inventory rule:
FileInfoReturn(%appdata%\Microsoft\Templates\NormalEmail.dotm, "Date last saved" , DATE)
The issue is the KACE agent runs as the SYSTEM account so the rule in looking in the SYSTEM's APPDATA folder (C:\WINDOWS\system32\config\systemprofile\AppData). Is there a variable to look in the Current logged on users %appdata% path?
Answers (2)
no, there isn't.
But you can create a little script and catch the results via CIR
Top Answer
Create a Script to run as the logged in user on a schedule and run something like: (Get-ChildItem $env:appdata\Microsoft\Templates\NormalEmail.dotm | Sort {$_.LastWriteTime}).LastWriteTime | Out-File C:\temp\msTemplate.txt
Then setup a custom inventory rule to collect the data: ShellCommandTextReturn(cmd /c type C:\temp\msTemplate.txt)