Windows Batch Scripting - Check for String - Report to Text File

I have a script that see's if a string is installed then reports back to a text file so I know how many installs completed successfully. This is the script I am using

"\\server\share\folder\filever.exe" "C:\Program files (x86)\MS Office\file.dll" |findstr "xxxxx"
if %errorlevel% EQU 0 (
     echo %computername% %date% %time% Software Installed >> "\\server\share\text_file_to_report_in.txt"

1. So is this the best way to run this, it is currently working fine but I am new to scripting and want to use "Best Practices"

2. How do I get this to run on all computer's, startup script or is there another way to send it out to report back to the text file?

3. If I send it out will all the computers be trying to write to the text file at the same time and kill everything?

Thanks in advance for the help.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1 This is ok. Based on what you'd like to do with that Version info you gather, there might be even better ways.
2 Startup script, correct.
3 Why would that do harm? Even if 100 machines per minute would write 10 kb of text each, why would that hurt your server? That isn't much traffic.
3 better use \\server\share\%computername%.txt to avoid any data mangling. Later, you could concatenate these files scripted again :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Newbie0000Author Commented:
Hi McKnife, thanks for the info.

I thought that will all the computers writing to the same file at the same time would cause issues with the file itself no so much the traffic or anything else.

And you answered that in your 2nd comment, thanks again.
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Newbie0000Author Commented:
So I was just told I can't put it in the start up script, so how can I run this on all pc's? I used DSQuery to get a list of PC's in each OU I had to deploy the software to so maybe I can use that list somehow to push this script out???
What was the reason for "not"?
Newbie0000Author Commented:
They don't want me doing my "checking" on the production GPO so I have to do it from my desk somehow???
Newbie0000Author Commented:
Desktop computer I mean, I run the DSQuery from my C:\ drive.
Ok, but tell me, what is more dangerous: running scripts from remote (which would need ports open and so on) or using the startscript which has no further implications. Very unwise decision by those guys.
You should look at psexec to do it from remote. But: it will only work on machines that are online - right now. So clearly, a Startup script is better.

You could also try to ask for a scheduled Task deployment that would do it.
NVITEnd-user supportCommented:
Also consider using the RunOnce key with psexec
If we use psexec, we are already remote, able to execute that codeline instantly. Why would one use that key, then?
Newbie0000Author Commented:
Thanks for the help McKnife and NVIT, I appreciate it. I will try to sort this out with the team as they all have their own "rules"
NVITEnd-user supportCommented:
Coz I haven't had coffee yet. LOL. Sorry about that
Newbie0000Author Commented:
So next time I put software out with a GPO I will just use the syntax above at the bottom of my script, do you see any issues with that?
Newbie0000Author Commented:
Can you help with the syntax for pcexec, to get me started please?
No issues using it in a Startup script or its bottom.
Just remember to test it, because hanging Startup scripts will take time to timeout.

psexec has lots of examples on the web, at sysinternals or Microsoft.
First, make sure what ist requirements are, maybe you won't be able to use it:
-Access to \\remotecomputer\admin$ (which will not work without you being admin on the remote System)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.