Solved

installation counter in a batch file

Posted on 2015-02-06
5
56 Views
Last Modified: 2016-06-23
Hello,

I would like my batch file ( executed via GPO start up script ) to record a successful installation and write to a network location

How do I incorporate this into my existing batch file listed below - ?

@echo off

if not exist "C:\Program Files\Autodesk" goto NOT

If exist "C:\Program Files\Autodesk" goto YES

:NOT

"\\server1\is$\dp2\ecs\ecs2015.lnk"

goto END
:YES
echo directory already there
goto END
:END

Nothing too fancy as batch files are not my thing !

Many thanks for suggestions.
0
Comment
Question by:joe wade
  • 2
5 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
You're probably better off doing something like having a successful install directory.

then you can do:

hostname >> \\networkpath\successful_installs.txt


That will write the hostname of the comptuer to the text file.  This way you know which machines were successfully installed and which machines you still need to look at.
0
 
LVL 26

Expert Comment

by:pony10us
Comment Utility
Try this:

@echo off

  If exist "C:\Program Files\Autodesk" (
	Echo Directory already exists on %COMPUTERNAME% so no action taken >> \\server1\folder\Autodesk_Installation_Tracking.txt
) ELSE (
	"\\server1\is$\dp2\ecs\ecs2015.lnk"
	Echo Directory created on %COMPUTERNAME% >> \\server1\folder\Autodesk_Installation_Tracking.txt
)

Open in new window


Replace "folder" with location you want the Autodesk_Installation_Tracking.txt file.
0
 

Author Comment

by:joe wade
Comment Utility
Hello pony10us,

Thanks for your suggestion. It was looking good and your code worked for a while and then stopped working.. I know that numerous desktops have ran the startup script via GPO fine but they have not written back to the Autodesk_Installation_Tracking.txt file.

Any ideas ?

Thanks
0
 
LVL 26

Accepted Solution

by:
pony10us earned 500 total points
Comment Utility
I have added the errorlevel to the end of each line of the text file.  If successful, the error level should be "0". Anything else means there was an error performing that step.

@echo off

  If exist "C:\Program Files\Autodesk" (
	Echo Directory already exists on %COMPUTERNAME% so no action taken %ERRORLEVEL%  >> \\server1\folder\Autodesk_Installation_Tracking.txt
) ELSE (
	"\\server1\is$\dp2\ecs\ecs2015.lnk"
	Echo Directory created on %COMPUTERNAME%  %ERRORLEVEL% >> \\server1\folder\Autodesk_Installation_Tracking.txt
	
)

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now