#68395 - 2002-07-16 05:44 PM
Capturing Net Start errors
|
Anonymous
Anonymous
Unregistered
|
Hi All, I've got a piece of software that is comprised of several services on a Windows NT 4 server. For general maintenance purposes, we have to stop and restart its services nightly. We have automated this process in a script using the net start command.
The problem is that every once in a while, a service will fail to start - returning an error 2140. Unfortunately, no event log message is made as a result - just the error message.
How do I get Kixtart to "catch" an error message resulting from the net start command?
Thanks in advance for any assistance
|
|
Top
|
|
|
|
#68397 - 2002-07-16 05:56 PM
Re: Capturing Net Start errors
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Don,
What you can do is something like:
SHELL "%COMSPEC% /C net start > c:\log.txt"
HTH,
Kent
|
|
Top
|
|
|
|
#68398 - 2002-07-16 06:14 PM
Re: Capturing Net Start errors
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
what about this?
code:
$COMPUTER="server"
$getobj=GetObject("winmgmts:{impersonationLevel=impersonate}!//$COMPUTER") $errmsg=$getobj.ExecQuery("Select * From Win32_NTLogEvent Where EventIdentifier='2140'")
For each $event in $errmsg $message=$event.message $ec =$event.EventIdentifier $time =$event.TimeGenerated $year =substr("$time",1,4) $hour=substr("$time",9,2) $month =substr("$time",5,2) $min =substr("$time",11,2) $day =substr("$time",7,2) $sec =substr("$time",13,2)
? "$ec $month/$day/$year $hour:$min:$sec" ? $Message ? next
I use this to pull ntbackup messages
|
|
Top
|
|
|
|
#68399 - 2002-07-16 06:20 PM
Re: Capturing Net Start errors
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Rad,
This would be good if he has Kixtart 4.x, but did not see what version he is running?
Kent
|
|
Top
|
|
|
|
#68400 - 2002-07-16 07:12 PM
Re: Capturing Net Start errors
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
btw.. if you need to record a command's error channel you need to specify channel 2
SHELL "%COMSPEC% /C net start 2> c:\log.txt"
|
|
Top
|
|
|
|
#68402 - 2002-07-17 02:23 AM
Re: Capturing Net Start errors
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Lonkero,
Isn't it returning to the wrong topic? We think that the golf guys want to know your current score. greetings.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 657 anonymous users online.
|
|
|