?
Solved

Create a batch file to search for folder and launch or not lauch another batch file

Posted on 2008-11-07
6
Medium Priority
?
869 Views
Last Modified: 2012-05-05
I need to create a batch file that performs the following:
1.      Check that Cisco Systems VPN is installed

a.      If no  Install VPN and them Go to  B

b.      If Yes  Check to see if the Client Access Agent is installed

·           IF YES = Done

·       If NO =        

o       Copy the .ini file

o       Copy a FOLDER(Profiles with the LanganASA.pcf file inside) to c:\program files\Cisco Systems\VPN   Client\

o       Copy mswinck.ocx to C:\windows\system32

o       Run Clean Access Agent



I have the files, folders and copy procedures. I am having trouble with the search and if then parts.  Also, the installation of the VPN client requires a reboot.  How do I make the process continue after a reboot?
This batch file will  be used to kick of the process in SCCM if that makes a difference.

Thanks
0
Comment
Question by:oweathersby
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
tenaj-207 earned 2000 total points
ID: 22911496
Without knowing the details I would write it like this;

Check that Cisco Systems VPN is installed by looking for a file that is installed by the software.  If it does exist then goto B
if exists c:\"program files"\CiscoSystemsVPNFile goto B

If it doesn't exist install it from the server
\\server\share\installCiscosoftware.exe '

Check to see if the Client program is installed using the same methodology.  If it does exist go to done.
:B if exists c:\"program files"\ClientAccessAgentFile.ini goto Done

Copy the needed ini file.
xcopy \\server\share\ClientAccessAgentFile.ini c:\"program files"\ClientAccessAgentFile.ini.ini

Copy the folder (/e=subfolders /y=suppress prompting) from the server
xcopy \\server\share\folder c:\WhereEverYouWantIt /e /y

Copy the oxc file to the PC from the server
xcopy \\server\share\mswinck.ocx C:\windows\system32

Exit the batch file
:Done exit

If you want to make the computer reboot then use the shutdown -r -t 0 command
If you want to make the computer run a batch file when the computer reboots then have it copy the needed file to the %userprofile%\"start menu\Programs\Startup" directory and have it delete itself at the end of the command.

If you want more information on xcopy or the shutdown command you can look at the help file by opening a command prompt and running;
CommandName /?.

For the batch file commands look at this web page.
http://www.aumha.org/a/batches.php
and
http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm

Good luck and let me know if I can explain anything in greater detail.
-tenaj
0
 

Author Comment

by:oweathersby
ID: 22925781
Hi Tenaj,

So far so good.  And I even found the away to make the VPN instllaer silent by creating setup.iss file :)
At the first check, if the designated VPN client file is not found, I am currently calling the next batch file to install teh VPN client.  The call command shoudl return control to this batch file once the called batch is doen running, correct?
0
 
LVL 15

Expert Comment

by:tenaj-207
ID: 22925977
Yes when the call command is complete it will return control to the original batch file.

And good job on the VPN installer.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:oweathersby
ID: 22967115
Hi Tenaj,

The batch file is working great.  There were other requirements that were added and I took care of all but two.  I am closing this question to assign you the points, but what do you think about the following:

First:
I used xcopy to put a folder and its contents in the desktop folder of all users.  I changed the icon of the folder form the standars folder image to a star.  WHen xcopy moves the folder, it does keep the custom folder icon of the star.  Is there a way to do that?

Second:
There is a registry key, computer state I believe, that has the OU the computer belongs to. There is other information in that key also.  How can I query the registry for that key and that one entry to use that as a variable on my batch file?

Thanks,

Omar W
0
 

Author Closing Comment

by:oweathersby
ID: 31514533
Thanks.  I did have other comments/question in the main message.
And for my knowledge, what are ther differences between batch files and scripts, besides script language is more "involved"?
0
 
LVL 15

Expert Comment

by:tenaj-207
ID: 22969538
First
Xcopy to my knowledge won't let you change the folder icon type.

Second
I'm not sure if you can query a registry key.  I know you can add, change, and delete them, but that's not what you need.

However, someone else here may know some additional information about both of the above questions.  If it's important then post another question about it.

Sorry I wasn't more help on that,
tenaj
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
I recently attended Cisco Live! in Las Vegas, a conference that boasted over 28,000 techies in attendance, and a week of hands-on learning hosted by a solid partner with which Concerto goes to market.  Every year, Cisco displays cutting-edge technol…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Suggested Courses
Course of the Month15 days, left to enroll

839 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