**"E: The expression could not be evaluated: class IllegalFileName".** Can anyone help to resolve this error

“E: The expression could not be evaluated: class IllegalFileName”. Can anyone help to resolve this error

As I am searching some files in entire system… and getting the above error with searched items.

q: pathnames of descendants whose (name of it as lowercase contains “1.ini” or name of it as lowercase contains “zer.exe” or name of it as lowercase contains “izer.exe” or name of it as lowercase contains “iezer.exe”) of folders “” of drives whose (type of it=“DRIVE_FIXED”)

I would avoid using the “descendants of” inspector for searching files across entire drives in a property as it will most likely have very undesirable side effects on the client (timeouts and/or client busy for long periods of time so unable to process other property and fixlet evaluation as well as file errors). The approach I’ve used that can avoid such issues I described in your post Required Analyses Fixlet to identify a file existance in entire system with the file location. I’ve used this for a number of file searches across over 100k managed endpoints with great success.

Regs
Rob

Hi @SLB, Just want to confirm one things… can we add some Keywords which we want to search in entire system, in your action script. Kindly suggest…

// Turn off wow redirection otherwise System32 folder search gets skipped due to redirection
action uses wow64 redirection false
parameter “outfile”="{expand environment string of “%25TEMP%25” as string & “\findfile.txt”}“
parameter “ImRunning”=”{expand environment string of “%25TEMP%25” as string & “\searching.txt”}"

delete {parameter “outfile”}
delete {parameter “ImRunning”}
// Create a marker file which is then uses by the property relevance to avoid “class FileIOError” errors when trying to list lines of a file locked for write access
// Run the DIR command after creating the marker file then delete the marker file so the property can read the file contents error free
createfile until EOF
echo. > {parameter “ImRunning”}
for /f “tokens=2 delims==:” %%d in (‘wmic logicaldisk where “drivetype=3” get name /format:value’) do @dir %%d:\file2find.exe /s /b >> {parameter “outfile”}
del {parameter “ImRunning”}"
EOF

delete FindFiles.cmd
copy __createfile FindFiles.cmd

runhidden FindFiles.cmd

Hi Varun,

No the file search example won’t search inside the files, it only searches file names. If searching inside of files is your requirement, I don’t think native actionscript commands would be the best option and you might be better off coming up with a script in something like PowerShell to do the work then use Bigfix to deploy and execute the script then audit the results

Regs
Rob

No, I mean where I need to add keywords to search a file in entire system… under your action script.

If you have a DIR command that does what you need, you can use that instead of the example I used. Eg

for /f “tokens=2 delims==:” %%d in (‘wmic logicaldisk where “drivetype=3” get name /format:value’) do @dir %%d:\file2find.exe ; %%d:\file /s /b* >> {parameter “outfile”}