Unattended logon to run script to start services via a batch file. 
Author Message
 Unattended logon to run script to start services via a batch file.

What an indoctrination!  I am new to VBScripting and have been asked
to write two scripts to start and stop services anytime the server is
shut down and restarted.  I have written two separate scripts to start
and stop the services.  However, I need to be logged on the server to
start the services (script). How can I have the script run, then logon
and start services or logon then run and start services.

For the shutdown, I need the stop services script to run before the
system shuts down.  Each services needs to have 15 minutes delay
between them.  How, can I delay execution of each one and what service
can I check for that will fire off the shut down services script?
Thanks in advance for any help!

NiColette Jackson



Sat, 20 Nov 2004 21:13:28 GMT  
 Unattended logon to run script to start services via a batch file.
What OS is the server running?  That makes a fairly big difference in how
I'd approach the problem.


Quote:
> What an indoctrination!  I am new to vbscripting and have been asked
> to write two scripts to start and stop services anytime the server is
> shut down and restarted.  I have written two separate scripts to start
> and stop the services.  However, I need to be logged on the server to
> start the services (script). How can I have the script run, then logon
> and start services or logon then run and start services.

> For the shutdown, I need the stop services script to run before the
> system shuts down.  Each services needs to have 15 minutes delay
> between them.  How, can I delay execution of each one and what service
> can I check for that will fire off the shut down services script?
> Thanks in advance for any help!

> NiColette Jackson



Sat, 20 Nov 2004 23:53:46 GMT  
 Unattended logon to run script to start services via a batch file.
The OS is Windows NT server.
Thanks for replying
NiColette

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 21 Nov 2004 00:17:31 GMT  
 Unattended logon to run script to start services via a batch file.
Is automatic logon an option for these machines?  If it is, then the answer
is much simpler.  If it's not, we'll have to get the scripts to run as
services (difficult, but not impossible).

If AutoLogin is OK, then set it up, then in the startup folder of the UserId
that logs onto the console (yours?) place shortcuts to the desired
script(s).

NT doesn't have a shutdown script the way Unix systems do.  It can be
emulated, but everyone with Admin/physical access to the machine needs to
know *not* to use the usual Start | Shut Down (or CTL-ALT-DEL | Shut Down)
methods as they will bypass the shutdown script.  Simply have a script/CMD
file in the path (or a shortcut on the desktop, whatever) named something
like DOWN, and run that.  DOWN will have the pre-shutdown commands in it so
they get run, then its last task is to perform a shutdown/reboot of the
system.  I'm fond of the resource kit utility shutdown.exe for this but
freeware utils that do the same thing are plentiful, just do a web search
using Google or whatever your favorite is.
If you trust SendKeys, then this is a quick-and-dirty way to do a Start |
Shut Down using VBS

set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESC}u{ENTER}"

But SendKeys is not eactly a bulletproof method.....MS provides this sample
shutdown.vbs:

Set OpSysSet =
GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from
Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
 OpSys.Shutdown()
next

You _*MUST*_ have WMI installed on the target system first though.  It's not
there by default with NT....

I got this from
http://www.microsoft.com/serviceproviders/downloads/free_visual_basic...
ts.asp
The scripts are simple but worth a look just to see how to use WMI to get
things done.


Quote:
> The OS is Windows NT server.
> Thanks for replying
> NiColette

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Sun, 21 Nov 2004 01:59:29 GMT  
 Unattended logon to run script to start services via a batch file.

Quote:

> NT doesn't have a shutdown script the way Unix systems do.

Just a side note: On Win2k and WinXP, you can enable shutdown scripts.

--
torgeir



Tue, 23 Nov 2004 06:46:16 GMT  
 Unattended logon to run script to start services via a batch file.
Standardized feature for ShutDown script support was implemented in W2K and
after!


Quote:

> > NT doesn't have a shutdown script the way Unix systems do.

> Just a side note: On Win2k and WinXP, you can enable shutdown scripts.

> --
> torgeir



Tue, 23 Nov 2004 10:54:10 GMT  
 Unattended logon to run script to start services via a batch file.
There is no autologin capability at this point and the script has to
run when the system unexpectantly shuts down.  Can I run a script in
the event of this type of shutdown?  If so, how.  I can't figure this
out.
NiColette


Tue, 23 Nov 2004 19:25:23 GMT  
 Unattended logon to run script to start services via a batch file.
You can use schedular on nt to schedule your scripts or write windows
scripts

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Thu, 25 Nov 2004 05:33:23 GMT  
 Unattended logon to run script to start services via a batch file.
That's what he *said*....


Quote:
> Standardized feature for ShutDown script support was implemented in W2K
and
> after!




> > > NT doesn't have a shutdown script the way Unix systems do.

> > Just a side note: On Win2k and WinXP, you can enable shutdown scripts.

> > --
> > torgeir



Wed, 24 Nov 2004 10:25:19 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Running VBS Script Via Logon Batch File

2. Run WSH logon script before NT shell starts?

3. Unable to run script via W2K Terminal Services Task Scheduler

4. Logon Script - Launched from BATCH file.

5. Get large file via http unattended

6. Running Scripting Host Files as Logon Script

7. Running a Batch File from a Script

8. Copying files to WinNT dir via logon script?

9. Running scripts with batch files

10. Copying files to WinNT dir via logon script?

11. START/STOP/ displayed Services running on PC thu an ASP page

12. Detecting whether a service is running and if not starting it

 

 
Powered by phpBB® Forum Software