I have wrote a batch file that I want it to run before a user log on (this is for Windows server 2003, and it worked fine for Windows XP as well). 

Basically, the batch file is a simple batch file that restarts itself if the service down.

I need the particular service run before log on or without a user log on, and the batch file are transparent to the user that logged on to the server. This is to make sure that other user logged on to that server will not accidentally close the batch file which will cause the service interruption.

In order to do so, I've compiled a simple vbscript (.vbs) that able to run the batch file in silent mode.

At the same time, whenever there is a system reboot, the service will be able to startup itself.

 

Batch file name: Arx_check_script.bat (Example of batch file)

@ECHO OFF

call sharecheck -sharefile sharecheck.txt -look -monitor -to This email address is being protected from spambots. You need JavaScript enabled to view it. -smtp 100.100.101.10 -from This email address is being protected from spambots. You need JavaScript enabled to view it.

 

 

arx_check_invisible_script.vbs

Set WshShell = CreateObject("WScript.Shell")

cmds=WshShell.RUN("C:\arx_checks\arx_check_script.bat", 0, True)

Set WshShell = Nothing

An alternative to using Task Scheduler is to use Group Policy. Task Scheduler lets you run tasks at boot time.

 

Goto Start > All Programs > Accessories > System tools > Scheduled task > Browse.

Select > arx_check_invisible_script.vbs

(This is to pointing the scheduler to the particular script/ program.)

Select > When my computer starts

(This action will restart the batch file / program whenever your system is reboot or boot up.)

Enter your user ID and password > Next

Then > Open advanced properties for this task when I click Finish.

 

Complete the task scheduler > go to Schedule.

Select > At System Startup.

You may also use the Group Policy editor for the Startup task.

 

Use the Group policy editor.

%systemroot%\system32\gpedit.msc

 

User Config\Windows Settings\Scripts\Logon/Logoff

Computer Config\Windows Settings\Scripts\Startup/Shutdown

 

 

Goto Run > gpedit.msc > OK.

User Configuration > Scripts (Logon / Logoff) > pointing to the arx_check_invisible_script.vbs file > OK.

Goto Start > All Programs > Accessories > System tools > Scheduled task.

Verify the schedule task, the status must be in "Running" mode. You may now restart / logoff your system to confirm the configuration is working.

Goto Start > RUN > key in "taskmgr" > Processes tab.

You will now see the particular process "Sharecheck.exe" is running now.