Searching for a computer name in a file

(imported topic written by SystemAdmin)

Would like to write relevance to check a remote text file to see if the computer name does NOT exist in the file. If it doesn’t exist, then the action would be performed.

(imported comment written by NoahSalzman)

This should work

not exists lines whose (it contains “computer-name”) of file “c:\file_with_computer_names.txt”

(imported comment written by SystemAdmin)

Thanks Noah. What if I want “computer-name” to be a variable (inserting the actual hostname of the client)

(imported comment written by NoahSalzman)

not exists lines whose (it contains computer name) of file “c:\file_with_computer_names.txt”

If the text file is going to have the computer name in lowercase then make it:

not exists lines whose (it contains computer name as lowercase) of file “c:\file_with_computer_names.txt”

(imported comment written by SystemAdmin)

Can the file being referenced be remote? If so, do I simply type:

exists lines whose (it contains computer name) of file “\remote_pc\serverlist.txt”

(imported comment written by labuski91)

brianfrahm

Can the file being referenced be remote? If so, do I simply type:

exists lines whose (it contains computer name) of file “\remote_pc\serverlist.txt”

i think it would be easier to do a dos net use command at the start of the action and just put “f:\filelocation” otherwise the way you have it youd have to make it a share.

(imported comment written by jessewk)

You do not want to reference a file on a share via relevance. If the client or relevance debugger has permission to access the share it would technically work, but you definitely don’t want to do that. You would have all your clients trying to access the share whenever they evaluate the relevance, no matter where they are in the network. Depending on your deployment, if you put that clause into Fixlet or property relevance that could mean every client in your deployment would try to hit the share every couple of minutes. The network implications are potentially huge even if they don’t have permission to access the share.

Can you explain more about what you are trying to accomplish? We can probably provide some alternative ideas.

Jesse

(imported comment written by labuski91)

jesse

you are absolutely right. for some reason i was thinking he wanted to do this in the action. but now looking at it with several hundred or even thousands of clients this could get nasty real quick.

(imported comment written by SystemAdmin)

Excellent point. Hadn’t thought about the bandwidth/file access implications.

(imported comment written by SystemAdmin)

Hi,

Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work…