run batch once on client computers

R

Ray at

A batch file can delete itself, so you can just throw del filename.bat at
the end of the batch.

Ray at home
 
W

Walter Schulz

I need to run a batch file once on all my workstations.
How can this be done

REM ===Batch.cmd===
IF EXIST c:\temp\flag.dat goto :EOF
REM Rest of batch
....
....
....
ECHO All done>c:\temp\flag.dat


Ciao, Walter
 
M

Mark V

Cedric wrote in
I need to run a batch file once on all my workstations.
How can this be done

You should say more about the environment. Are the systems part of a
Domain (Domain logon scripts or Group Policies or other "push"
methods). What does tha batch have to do. IOW make modifications or
run programs that the user _could_ run manually or do stuff that only
an administrator could do. NTx clients or W9x? ... and so forth.

"Walter" posts one way to use a "flag" file to indicate if the batch
was previously run. This "flag" can also be done using a registry key
you create.
 
C

Cedric

Okay,

As requested I will give a better detail of my network
enviroment. I have one Windows 2000 Domain Controller
server and 10 windows 2000 clients. I need to run a batch
file once on all my workstations. I would like to do this
when the workstations first boot up. I do not want to have
to manually do this from each of the workstations. I would
love to be able to run the batch file as a group policy
are a start up script, but only once.

The batch file is called verase.bat
 
D

David Lampron

!!! If you don't need admin privileges, replace ADMIN_NAME with a user with
lower credentials.

What It does ?
After the image process is complete 'altiris/ghost/...' the computer will
reboot and autolog with the user specified in the registry 'don't need to
manually log to each pc : ) '. on startup it will ~RunOnce 'verase.bat'.
When the task will be done the computer reboot and come back to the normal
login prompt.


How to :

-Step1-----------------------------------------------------------

Enable AutoLogon

-------EnableAutologon.reg-------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultDomainName"="DOMAIN_NAME"
"DefaultUserName"="ADMIN_NAME"
"AutoAdminLogon"="1"
"DefaultPassword"="PASSWORD"
"AutoLogonCount"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"AddBoot"="c:\\WINNT\\verase.bat"
-------

-Step2-----------------------------------------------------------

Add verase.bat, reglog.reg, shutdown.exe www.budja.com/shutdown to the
WINDOWS folders

----verase.bat----
REM Initial content of verase.bat
REM ...
regedit /s C:\WINNT\reglog.reg
shutdown -r -f
exit
-------

Remove unwanted key 'value'
----reglog.reg----
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"="0"
"AutoLogonCount"=dword:00000000
"DefaultPassword"=""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top