Start Program Automatically after Windows XP boot

I'm setting up a couple of PC's that will access software on a server via Terminal Services.   I would like to completely automate this process, i.e., Push the Start button on the case, boot up, automatically use a predetermined remote desktop connection (with credentials to logon to the server) and reach the login screen for the software that I want to access - without end user intervention.  When the end user has finished working and logs out of the software, I would like for the client pc to shut down automatically.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Open the remote desktop client. Fill in the destination and credentials if you wish. Then click "Save as" and save the rdp-file to an accessible location (for example: C:\Auto.rdp)

Create a batch file and copy these commands In it:

%systemroot%\system32\mstsc.exe "C:\Auto.rdp"
%systemroot%\System32\Shutdown -s -t 00

Make sure the path to the rdp-file in the batch-file is the same as the location where you saved the rdp-file.

Copy the new batch file to your startup folder of the current user:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\

OR to the startup-folder for all users:
%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup\

That should do it.
baleman2Author Commented:
One question.  In order to do maintenance on the client at such time as I may need to do so - how will I be able to reach the Windows desktop INSTEAD of immediately logging on to the server?
Download the "Windows Server 2003 Resource Kit Tools" here:
Install it. Then add this at the beginning of your batch-file:

@echo "Starting remote desktop in 5 secs. Press CTRL-C to cancel!"
@C:\Program Files\Windows Resource Kits\Tools\Sleep.exe 5

Make sure the path to Sleep.exe matches the path where you installed the tools. If you press CTRL-C you will be asked to terminate the batch-job. If you confirm with "Y" the remote desktop will not start.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

baleman2Author Commented:
Will attempt today and report ASAP.
baleman2Author Commented:
Sorry to be so late reporting results.  Am very satisfied because the pc does "boot" and move straight to the login screen of the server. . . and shuts down upon exit.  However, after the batch file begins to run the command:

@echo "Starting remote desktop in 5 secs. Press CTRL-C to cancel!" , this appears directly beneath:

So, I'm currently "locked" into booting straight to the server - can't stop the process.

Also, can the "command prompt" window (where the batch file commands appear) run in full-screen?

The Windows desktop appears behind it now.  This is going to lend itself to the "end user" trying to click on icons before the login to the server completes.
To break the cycle, I think there are 2 possibilities.
1. After the reboot, hit F8 and run safe mode. The batch-file will not run. You can remove or edit the batch-file from safe-mode and then boot normally again.
2. Minimize the remote-desktop screen, by hovering your mouse to the top-middle of the screen and wait for the yellow bar to appear and click minimize (not close, because then the batch-file will continue to shut-down). Then close the command-prompt window. This will break the batch-file. Then you can close the remote-desktop without the shutdown.

The "cannot find the file specified" probably means that the "sleep.exe" is not in the location you specified in the batch file. Verify the path and any type-errors in the batch-file.

I think you can only modify the size of the command-prompt by moving the batch-file to another location. Then put a shortcut to the batch-file in the Startup-folder. Then open the properties of the shortcut. Then under the layout-tab you can enter the window-size in characters. You have to try, which size is best for you. Alternatively, you could remove all icons from the desktop, since these are never meant to be used anyway.

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
baleman2Author Commented:
HeathCliff74 - This is what I call SUPPORT!!!!!   Every step was clear, concise, and absolutely accurate.  You COMPLETELY solved my problems.  Thanks so much!
Glad I could help. Good luck!
baleman2Author Commented:
One addendum if I may:
I have two of these pc's "autologging" in the same office.  The two are in their own small workgroup so as not to interfere with a larger LAN in the same building.  Only one of these two pc's has a printer (HP p2015 laserjet) connected to it via USB cable. . . and it is shared.  The 2nd PC has it installed as a "network" printer.  Would the "autologging" process have anything to do with the 2nd PC "not" being able to print to the shared printer on the 1st pc?
The autologon should not interfere. When you cancel the logon to the remote desktop, can you use the network printer from the local desktop?

If so then you should probably edit the rdp-file you saved for the autologon. Open the remote desktop client, expand the "options", click open and select the rdp-file. Go to the local-resources-tab and check the option "Printers". Go back to the general-tab and click save. That should bring the network-printer to your remote-desktop. Alternatively you could try to add the printer as a network-printer within the remote desktop.

If you are not able to use the printer from your local desktop, then that would be a different problem and most probably not related to the autologon or remote desktop.
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.