|
|
|||||||
I am in the procces of completing a script that will allow for an Exchange 5.5 site swap and i am stuck at this point.... I need to get the results of the following command $ExchsrvIS="MSExchangeIS" Shell '%CompSpec% /c net start $ExchsrvIS' Basically i have tried the @error and @serror, and both supply no usfull information. I need the errors generated from the service start request. Errors i am expecting to see may be 5882, 1011, 1276, and normal ones like service started or service not started.... any advise would be most appreciated. Environment is NT Server 4.0 SP6 with IE 4.0 Thanks in advance, Jeff |
||||||||
|
|
|||||||
is what you are looking for. |
||||||||
|
|
|||||||
thanks for the prompt reply, error returned is 2 the system cannot find the file specified.... The actual error generated from the net start is... The Microsoft Exchange Information Store could not be started. A service specific error occurred:1276. not sure how to get this msg to kix |
||||||||
|
|
|||||||
Well now you know that error 2 means "The Microsoft Exchange Information Store could not be started. A service specific error occurred:1276." so. code:$ExchsrvIS="MSExchangeIS" |
||||||||
|
|
|||||||
Sorry forgot to say what Error check is producing error 2, @ERROR OR @SERROR. Change If @ERROR = "2" depending on the error check. |
||||||||
|
|
|||||||
one problem with that is this, if i issue a net stop command i get the same error code. Scenero: MSExchange IS not started net start gives error code 2, actual is ... The Microsoft Exchange Information Store could not be started. A service specific error occurred:1276 net stop gives error code 2, actual is ... The Microsoft Exchange Information Store service is not started. |
||||||||
|
|
|||||||
This should work for you. $service = service name, $Option = 1 for start 0 for stop. [ 16. October 2003, 12:16: Message edited by: Richard Farthing ] |
||||||||
|
|
|||||||
heh. boys boys. the errors are STANDARD errorcodes. you can't just change the meaning. 2 means what 2 means. if it says 2, it has problem with net. now, if it can't start net, I have to ask is your PATH variable screwed on that machine you try to fire it on. |
||||||||
|
|
|||||||
Woops Lonk is right, I should really read the questions before jumping in. quote: |
||||||||
|
|
|||||||
okies, i be a tad confused... if paths are messed up then how come the command does get executed and i get the service specifiv error code? |
||||||||
|
|
|||||||
Can you start and stop the service via a command line. Does it Start and stop there without any error's. |
||||||||
|
|
|||||||
sure i can start the service from a command line with a clean DB in the exchange db directory.. will run a few more test on my way home, but most odd, not sure why it would be passing error code 2 |
||||||||
|
|
|||||||
not just on commandline but in the dir where the kix is and where the script is. net.exe resides in system32. so if %windir%\system32 is not on your %path%, the error 2 is obvious. otherwise I have to wonder, wonder a lot. |
||||||||
|
|
|||||||
It may have just been a transcription typo in your first post, but the command intepreter is %COMSPEC%, not %CompSpec% |
||||||||
|
|
|||||||
Okies, now I have made things very simple. And yes my path statement is correct, I thoroughly tested various net commands and all worked from every directory. The script has been changed to test against the alerter service which all NT/XP builds have out of the box. Shell '%ComSpec% /c net stop alerter' "error returned: (" @error ") " @serror Scenario: Alerter service stopped. C:\Documents and Settings\lynchj>kix32 d:\kix\svcr1 The Alerter service is stopping. The Alerter service was stopped successfully. error returned: (0) The operation completed successfully. C:\Documents and Settings\lynchj>kix32 d:\kix\svcr1 The Alerter service is not started. More help is available by typing NET HELPMSG 3521. error returned: (2) The system cannot find the file specified. OK now I modified the net stop to be a net start and here are the results. C:\Documents and Settings\lynchj>kix32 d:\kix\svcr1 The Alerter service is starting. The Alerter service was started successfully. error returned: (0) The operation completed successfully. C:\Documents and Settings\lynchj>kix32 d:\kix\svcr1 The requested service has already been started. More help is available by typing NET HELPMSG 2182. error returned: (2) The system cannot find the file specified. Okies, goal is to get the actual error txt that is displayed when attempting to start or stop the service, since it returns the same error code when starting or stopping the service. Haven't been stumped with a kix script in a while, and this doesn't logically seem all that hard which is what's making it all the more frustrating Might i be barking up the wrong tree, is there an alternative that can be used to extract the error text? |
||||||||
|
|
|||||||
k, me tested this stuff as don't wanted to say anything not true. and found out that I already did. net seems to NOT have standard errors even thought it should indeed be the standard for that same thing (net helpmsg) it seems that it always returns 2 as error if service is already in the state you want to set it. this is not in kix only but if you do:
on commandline, you see that it also returns same errors. |
||||||||
|
|
|||||||
Please checkout my UDF as I believe that the set proper errorcode is set. http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000205 Don't quite know why you want to use 'SHELL "net ..."' anyway. [ 16. October 2003, 22:31: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
code:will pipe the resulting messages into text files which can then be read via OPEN-READLINE-CLOSE. Alternativewly, use any of the 'pipe' UDFs.$ExchsrvIS="MSExchangeIS" |
||||||||
|
|
|||||||
Thanks for all the assistance folks. This is as far as I have gotten, using excerpts from postings. Was wondering if this was clean or if it could be streamlined more. Dim $ErrReturn[8] $ExchsrvIS="MSExchangeIS" Shell '%Comspec% /c net stop $ExchsrvIS >%Temp%\status.log 2>%Temp%\err.log' $f=Open(1,"%Temp%\err.log",2) $x=Readline(1) While @error=0 $ErrReturn[$c]=$x $x=Readline(1) $c=$c+1 Loop $f=Close(1) $rc=Substr($ErrReturn[2],Len($ErrReturn[2])-4,4) If $rc="" $rc1=$ErrReturn[0] $rc=Substr($ErrReturn[3],Len($ErrReturn[3])-4,4) Endif Select Case $rc="2182" $ErrCode="The Requested service has already been started." Case $rc="3521" $ErrCode="The "+$ExchsrvIS+" service is not started." Case $rc="5882" $ErrCode="The RIP Key needs to be deleted and ExchangeSA needs to be restarted first." $RC1? Case $rc="1011" $ErrCode="Isinteg needs to e run to bring PRIV to Consistant State." $RC1? Case $rc="1276" $ErrCode="Restored PRIV not meant for current Site, Site needs to be swapped" $RC1? EndSelect ?$ErrCode Any feedback would be appreciated |
||||||||
|
|
|||||||
See the OPEN() example in the KiXtart Manual and use FREEFILEHANDLE() to assign a free filehandle instead of hardcoding it. You also do not check whether the OPEN() is successful. And see the UDF Forum for 'read file' and 'pipe' UDFs. |