/build/static/layout/Breadcrumb_cap_w.png

Is there a way to find if a file exists on a PC if you don't know the path?

I have a number of PCs that have a particular file on them lets call it "abc.exe"  The problem is that the developer who built the install configured it to generate a random install directory.  Is there a way I can search for the file using wildcards or just the entire C drive for example in my KACE System Managment Appliance?


0 Comments   [ + ] Show comments

Answers (2)

Posted by: AmberSDNB 1 month ago
Orange Belt
0

Step 1

You could have a Powershell script that either runs once or on a schedule depending on your needs. (in Kace or group policy)
Get-ChildItem 'C:\' -Filter 'abc.exe' -Recurse -ErrorAction SilentlyContinue | % { $_.FullName } | Out-File C:\Temp\abc.log
This will dump a log file containing all the entries into the temp folder.


Step 2

Then in Kace...

Go to Inventory > Software
Do 'Choose Action' - New
Enter a name (whatever you want to call it), assign to an operating system (do all Windows)
Under Custom inventory rule, enter the following:
ShellCommandTextReturn(cmd /c type "C:\Temp\abc.log")

After the script runs and that file exists, once the computers check into Kace that data will get sucked into Inventory > Devices under Custom Inventory Fields and you'll be able to see the location.

Note:
There may be a way to even skip the script step, and just to get this to run as a custom inventory rule in of itself. But it doesn't seem to be working when I tried.
ShellCommandTextReturn(cmd /q /c powershell.exe -command "Get-ChildItem 'C:\' -Filter 'abc.exe' -Recurse -ErrorAction SilentlyContinue | % { $_.FullName }")

Posted by: AmberSDNB 1 month ago
Orange Belt
0

Update:

This appears to work as just a custom inventory rule with no script step 1 required (should hit 32 and 64 bit folders, I think the original method was only hitting 32 bit folders due to agent being 32 bit)
ShellCommandTextReturn(cmd /q /c C:\windows\sysnative\WindowsPowerShell\v1.0\powershell.exe -command "Get-ChildItem 'C:\' -Filter 'abc.exe' -Recurse -ErrorAction SilentlyContinue | ForEach-Object {$_.FullName}")

 
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