How to find if a file exists (in the local user's profile)
I can easily set up a custom inventory rule to identify systems that have a certain file if the file is in a static location, such as outlined here:
However I'm tasked with finding computers that have a file in %userprofile%\appdata\Roaming\Microsoft\Word\STARTUP.
I'm having troubles getting this to work because from what I understand, the inventory is run as a service and therefore has no understanding of the dynamic userprofile folders. Any ideas?
Please log in to answer
Posted by: chucksteel 3 years ago
Here's a one liner that should work in a ShellCommandTextReturn
echo off & for /d %u in (\Users\*) do (if exist %u\appdata\Roaming\Microsoft\Word\Startup\filename.ext echo %u)
The echo off makes the display a little nicer and the output should be something like this:
The users that have the file in their profile will be listed. This will also work for directories.