We help IT Professionals succeed at work.

How do I have a Batch file report the "Machine" name back to a log file after a program installation?

Last Modified: 2012-06-27
I am using a simple batch file via GPO to install an application to a series of machines.

The batch file simply looks for a directory, if it doesn't exist, it installs the application.  What I would like the batch file to do is write back to a log file, that the machine (name) did actually install, or that it already had the application.  The code I am using thus far is attached.

Using this method, I AM getting the "ECHO" part written to the listed log file... but what I need is the actual "MACHINE NAME" or even the "USER LOGON" name appended to the file... how do I call those variables from MSDOS or create them and actually send them with the append request?

If anyone could help, this would be greatly appreciated!

Thank you!
If exist C:\PROGRA~1\"Trend Micro" goto end
\\cobia\ofcscan\Pccnt\Disk1\install.exe /S
ECHO Machine Has Application >> \\anchovy\GPO_Apps\OfficeScan\alreadyinstalled.txt

Open in new window

Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
RartemassLife Coach

You can use the hostname command.
When run in DOS it will return the name of the PC.
This one is on us!
(Get your first solution completely free - no credit card required)


Thank you so much for the fast reply!  Much much much appreciated!!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.