
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!