Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Small Business Server / SBS 2000 / March 2004

Tip: Looking for answers? Try searching our database.

Run a batch file or script after boot but before login?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NickP - 30 Mar 2004 13:24 GMT
Hi All,

Does anyone know if there's a way of running a batch file or script after an
SBS2k box restarts & with a 5 minute delay but prior to the box being logged
on - i.e. I'd like to run a script after a server restarts unattended, but
after all services have started.

E.g. running <<adsutil STOP_SERVER W3SVC/1>> & then <<adsutil START_SERVER
W3SVC/1>> to get around the IIS OWA components not starting properly because
of fighting over ports with ISA.

Thanks!

NickP
Dave Stoecker - 30 Mar 2004 16:43 GMT
Here is a thought...
Add a policy object to the Domain Controllers OU - if you have additional
DCs, filter the ACL on the policy object so only the SBS can apply it.
(Group Policy) > Computer Configuration . Windows Settings > Scripts
(startup)
Reference your script there.  The 5 minute wait will need to be built in to
the script (you could use Sleep or Timeout utilities from the Resource Kit,
or some other method).

hth - DS

> Hi All,
>
[quoted text clipped - 10 lines]
>
> NickP
IBC - 30 Mar 2004 17:52 GMT
I would think adding those lines to the login script would do it. I'm not a
scripting person since I know little about it, but I would think you could
tell the script to run a SECOND script that has a delay statement in it and
the stop/start command. I'm wondering if you put a wait command in the login
script if you would have to wait for it to finish before it allowed the
machine to finish logging in.

Actually, I suppose it can't be a log in script....If you aren't logging in
after a reboot it won't help. So some form of start up script then...like
Dave said.

If you get this worked out, I'd love to see the script (as would many others
I assume).

Thanks

> Here is a thought...
> Add a policy object to the Domain Controllers OU - if you have additional
[quoted text clipped - 24 lines]
> >
> > NickP
Jeff Middleton [SBS-MVP] - 30 Mar 2004 18:05 GMT
I think that Dave's idea probably will work, but it can also be dependent
upon what exactly you want the script to do. For instance, certain kinds of
things can't be done without Explorer loaded, or without MSGINA launched, or
such.

There's also this Kb:
How to Run a Batch File Before Logging on to Your Computer
http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> Here is a thought...
> Add a policy object to the Domain Controllers OU - if you have additional
[quoted text clipped - 24 lines]
> >
> > NickP
Dave Stoecker - 30 Mar 2004 19:09 GMT
That is a handy KB, and thanks for pointing out some possible limitations
when using startup scripts.

Another minor thought regarding the idea I suggested:

I just read some of the Resource Kit group policy documentation again, and
the default maximum wait for (all) script processing to complete before
displaying the logon screen is 10 minutes, so if there was a problem with
the script's execution that isn't handled in the script itself (say W3SVC
won't restart for some reason) it could prevent anyone from logging in to
the SBS until the wait time expired.  Perhaps not a big issue, but just in
case,

The maximum wait time (in seconds) can be configured at this policy
location:
   Computer Configuration\Administrative Templates\System\Logon "maximum
wait time for group policy scripts"

DS

> I think that Dave's idea probably will work, but it can also be dependent
> upon what exactly you want the script to do. For instance, certain kinds of
[quoted text clipped - 3 lines]
> There's also this Kb:
> How to Run a Batch File Before Logging on to Your Computer

http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> > Here is a thought...
> > Add a policy object to the Domain Controllers OU - if you have additional
[quoted text clipped - 29 lines]
> > >
> > > NickP
NickP - 30 Mar 2004 19:59 GMT
Interesting & useful - thank you all. I'll try those out.

NickP

> That is a handy KB, and thanks for pointing out some possible limitations
> when using startup scripts.
[quoted text clipped - 25 lines]
> > There's also this Kb:
> > How to Run a Batch File Before Logging on to Your Computer

http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> > > Here is a thought...
> > > Add a policy object to the Domain Controllers OU - if you have
[quoted text clipped - 30 lines]
> > > >
> > > > NickP
Jeff Middleton [SBS-MVP] - 30 Mar 2004 20:56 GMT
FYI...the problem of a script hanging in the manner you are thinking can be
addressed by using a script that spawns an instance of something without
waiting for completion, or even being concerned about the success of that
spawned process. At the risk of going over the top in this discussion with
theory when we don't even have an application in mind, I'll just leave this
as an added comment. If you wanted something to happen in 15 minutes, and if
you could determine that the scheduler was started, your script could simply
initiate a scheduled event, not actually launch the event. The scheduler
would do it's thing, and the only part the start script would have to get
right is handing the scheduler to event information.

> That is a handy KB, and thanks for pointing out some possible limitations
> when using startup scripts.
[quoted text clipped - 25 lines]
> > There's also this Kb:
> > How to Run a Batch File Before Logging on to Your Computer

http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> > > Here is a thought...
> > > Add a policy object to the Domain Controllers OU - if you have
[quoted text clipped - 30 lines]
> > > >
> > > > NickP
Dave Stoecker - 30 Mar 2004 22:06 GMT
Yeah, you're right of course.  And makes me think, the OP should just write
a .bat file to Net Stop/Start W3SVC after a 5 minute wait, and use the
scheduler to run it at system startup. Much simpler than using a policy.

> FYI...the problem of a script hanging in the manner you are thinking can be
> addressed by using a script that spawns an instance of something without
[quoted text clipped - 38 lines]
> > > There's also this Kb:
> > > How to Run a Batch File Before Logging on to Your Computer

http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> > > > Here is a thought...
> > > > Add a policy object to the Domain Controllers OU - if you have
[quoted text clipped - 33 lines]
> > > > >
> > > > > NickP
Dave Stoecker - 30 Mar 2004 22:13 GMT
Or whatever the required command is to remedy his OWA port issue...

> Yeah, you're right of course.  And makes me think, the OP should just write
> a .bat file to Net Stop/Start W3SVC after a 5 minute wait, and use the
[quoted text clipped - 54 lines]
> > > > There's also this Kb:
> > > > How to Run a Batch File Before Logging on to Your Computer

http://support.microsoft.com/default.aspx?scid=kb;en-us;243486&Product=win2000

> > > > > Here is a thought...
> > > > > Add a policy object to the Domain Controllers OU - if you have
[quoted text clipped - 38 lines]
> > > > > >
> > > > > > NickP
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.