E
E
Eugen L2017-10-15 13:17:33
System administration
Eugen L, 2017-10-15 13:17:33

Logging the execution of CMD commands?

The essence of the question is simple - there are N number of PCs on them in the download is a .bat that executes a specific command and writes the result of the command to the log. It is necessary to force the result of not only the execution of the command to be recorded, but also parameters such as "%date% %time% %username% %computername%" for each PC and collect the whole thing in 1 log in a ball that will be on the local network.
Separately, displaying individual logs is not a problem, but putting it all together is a question.
What would be something like this
01/01/2017 00:00 User1 Pc1 command:OK
01/01/2017 00:01 User2 Pc2 command:OK
I think about implementing it like this (primitively):

  1. echo "%date% %time% %username% %computername% >> \\serv1\logs\output.log
  2. command>>\\serv1\logs\output.log

But I think there will be problems with simultaneous recording from all PCs. I think there will be some jambs, so tell me how to simultaneously write the result of commands 1 + 2 in one line

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question