?
Solved

create a batch file to run an exe file once

Posted on 2007-10-03
4
Medium Priority
?
4,515 Views
Last Modified: 2011-08-18
Hi All,

I have a windows 2000 server which runs a log in script in ad for clients to map drives.  I need to install an exe file on all of the machines in the network.  I would like to run this exe file automatically in the log in script.  I was told I need to create a batch file to call the exe file and then that batch file from the login script.  I also only want this exe file to run only once on each machine.  Can anybody help?

Many thanks,

FL
0
Comment
Question by:foreverlearning
3 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 1000 total points
ID: 20007975
You could have the install process generate a file and then check for its presence like so:

if not exist c:\SoftwareInstalled.txt (
 call "\\server\share\installer.exe"
 echo Done. > c:\SoftwareInstalled.txt
)

Keep in mind that anything in a logon script runs under the user's credentials, so if the .exe requires administrator rights then it won't work correctly for normal users.
0
 
LVL 1

Assisted Solution

by:krawz187
krawz187 earned 1000 total points
ID: 20008070
This is perhaps not the prettiest or most reliable way, but maybe it will give you a starting point.  It would be much better if you had some error handling in it, but I'm not as experienced with scripting as I'd like to be.

(Script1.cmd)

@echo off
REM ########## Run EXE File (once)

mkdir %SystemDrive%\install
if exist %SystemDrive%\install\EXE_file1_Finished.txt goto NOinstall
call %LOGONSERVER%\netlogon\Script2.cmd
:NOinstall
exit


(Script2.cmd)

@echo off
xcopy /YHRC %LOGONSERVER%\netlogon\File1.exe %SystemDrive%\install\
%SystemDrive%\install\File1.exe /<SilentInstallSwitches>
xcopy /YHRC %LOGONSERVER%\netlogon\EXE_file1_Finished.txt %SystemDrive%\install\
exit
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20962480
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

850 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