Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Startup Script Help

Status
Not open for further replies.

beatdown

Technical User
Feb 27, 2005
85
US
Hi everyone,

I'm a total rookie when it comes to scripts, so I'm hoping someone here can tell me how to do this, or point me in the right direction.

Our ERP product runs on a Windows Server 2003 system. In order for clients to be able to connect, an administrator has to log onto the server, launch a program called host.exe, and then stay logged on. Otherwise saying, you cannot run host.exe as a service, and it must always be running.

The problem is that sometimes the server will reboot, but the admin forgets, or is unavailble to log in and launch host.exe.

Is it possible to use a startup script, that will automatically log in the local (or domain) administrator when the server reboots?

I'm not sure if such a script exists, or is even possible, but if it is, can anyone tell me how to obtain such a script?

Thanks very much,
Steve
 
are there startup script options in group policy that can be applied to machines?
 
You can use group policy to apply a startup script to an OU in Active Directory, but there are no tools or options for creating the script. The only option is to simply enable the startup policy, and then point group policy to the folder where the script is located on your server.
 
so, can you point the Group Policy to a script on the server??? that script being "c:\program files\ERP\host.exe
 
The way I understand it, somebody has to log onto the server and then run the host program. It won't run as a service.
 
Beatdown,

Does the application just need to be started or do credentials need to also be entered? Can you provide keystrokes that would be needed?

Security would be my biggest concern. Launching the application will be easy, but to have this happen at system startup will require your server to be configured for Autologon which is not a recommended security practice.

If you are OK with that and are confident that your server is physically secure from non-admins getting to it then the whole process is simple.

You would configure Autologin on the server and then can start the program in a number of ways. Ideas that come to mind are:

1. Add to the startup folder in Start Menu
2. Add to Run key in registry
3. Add to a script or batch file and lunch via startup folder
4. Add to a script or batch file and lunch via Run key in registry
5. Add to a script or batch file and lunch via local group policy as startup script

I would have it launched as part of a vbscript so you can also force the screen to lock after the autologin. It only takes 2 lines of code for that:

Code:
Set WshShell = CreateObject("wscript.Shell")
WshShell.Run("rundll32.exe user32.dll, LockWorkstation")


So if your file is called HOSTS.EXE you could do all I mention above like this:
Code:
Set WshShell = CreateObject("wscript.Shell")
WshShell.Run("hosts.exe")
WshShell.Run("rundll32.exe user32.dll, LockWorkstation")

If you need to feed credentials then you need to provide keystrokes so you could use the SendKeys method.

I hope you find this post helpful.

Regards,

Mark
 
Realistically, I would just set the server to autologon. Then one of the startup items should lock the console.

Set the following registry keys:

Value: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
Type: REG_SZ
Data: 1

Value: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName
Type: REG_SZ
Data: <your domain name>

Value: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName
Type: REG_SZ
Data: <your user name>

Value: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword
Type: REG_SZ
Data: <your password>

In the startup items for that user create 2 items...
1) your "host.exe" program
2) a shortcut with this command: [blue]"%windir%\System32\rundll32.exe user32.dll,LockWorkStation"[/blue] to lock the console

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Shame on me for not reading Mark. You said the same thing.

[blush]

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
No worries PSC. Just shows it is good advice.

I wriote a script to configure the autologon and lock the screen. thread96-1193203

I hope you find this post helpful.

Regards,

Mark
 
seems circular.

anyway, strictly not a vbscript question but has been mentioned on this thread...does a machine startup script still need a user to logon before it is run!!??
 
No login/logoff scripts apply to the user. Startup/Shutdown scripts apply to the PC.

Note that I am suggesting you use the Login script because you would be setting autologin which is then associated with a user.

I hope you find this post helpful.

Regards,

Mark
 
Startup / Shutdown scripts are run under the context of the machine account. Generally not good for applications that need to interact with the desktop.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
this was the confusion for me, the original post doesnt explicitly say that the host.exe needs to interact with the desktop...

by circular i meant that in order to use a logonscript one needs to set autologon, autologon is set by a script which is run...

thanks for the clarification people
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top