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

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.

Who is Participating?
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.

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.

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

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
oweathersbyAuthor Commented:
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?
Yes when the call command is complete it will return control to the original batch file.

And good job on the VPN installer.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

oweathersbyAuthor Commented:
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:

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?

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?


Omar W
oweathersbyAuthor Commented:
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"?
Xcopy to my knowledge won't let you change the folder icon type.

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,
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 XP

From novice to tech pro — start learning today.