I want to be able to query a remote windows desktop for a particular file however I have the following constraints:
- I cannot make the assumption that powershell remoting is enabled.
- I don't know the exact location of the file
- Time is a factor
This has led me to the following query:
SELECT * FROM CIM_DataFile WHERE Drive ='C:'AND FileName='Fake' AND Extension='dll'
This takes a relatively long time in comparison to something like Get-childitem
in powershell which allows me to refine my search by folders and subfolders.
I could always do something like:
SELECT * FROM CIM_DataFile WHERE Drive ='C:'AND FileName='Fake' AND Extension='dll' AND Path like '\\Windows\\System32\\%'
however this query increases the load on the remote and doesn't actually take any less time.
Is there any way I can use WMI to do some type of recursive search?