Page 1 of 1 1
Topic Options
#60332 - 2001-11-07 12:49 AM Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


I need help..... I have a script which I have included that will not run with the WINAT.EXE which was provided with the NT 4 Resource kit. I add the scheduled task in the following manner; C:\Scripts\kix32.exe c:\scripts\drvspc.kix.

When it runs nothing is sent but the error message that is within the script. If I run from the command line, it works fine. I have not yet been able to get a job scheduled on a workstation yet.... Anyone have ideas?

** [CODE} **
break on cls
;=========================================================================================
; DRVCHK.KIX
;=========================================================================================
;=========================================================================================
; You must use double @. Send to multi admins by separating email address with a ,
;=========================================================================================
$adminEmail = 'administrator@@whatever.com'

;=========================================================================================
; Check to make Sure the BLAT Software program is installed within the Registery
;=========================================================================================
$blatRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat"

;=========================================================================================
; Use the Carbon Copy Database
;=========================================================================================
$ccbase = "c:\scripts\ccbase.ini"

;=========================================================================================
; Create a Return and Line Feed
;=========================================================================================
$cr = chr(13)+chr(10)
$space = ' '
$FILL="| |"
;=========================================================================================
; Set the Tempary Directory location
;=========================================================================================
$tempfile = "%temp%\temp.dat"

;=========================================================================================
; Set the Counter to value of One
;=========================================================================================
$counter = 1

Dim $Drv[23]
$Drv[1]="\\dom-A\C$"
$Drv[2]="\\dom-A\E$"
$Drv[3]="\\dom-A\F$"
$Drv[4]="\\bdc-A\C$"
$Drv[5]="\\bdc-A\E$"
$Drv[6]="\\bdc-A\F$"
$Drv[7]="\\bdc-A\G$"
$Drv[8]="\\bdc-A\H$"
$Drv[9]="\\wts\C$"
$Drv[10]="\\wts\D$"
$Drv[11]="\\gateway\C$"
$Drv[12]="\\nnt\C$"
$Drv[13]="\\nnt\D$"
$Drv[14]="\\nnt\E$"
$Drv[15]="\\dom-B\C$"
$Drv[16]="\\dom-B\E$"
$Drv[17]="\\dom-B\F$"
$Drv[18]="\\dom_C\C$"
$Drv[19]="\\dom_C\E$"
$Drv[20]="\\dom_C\F$"
$Drv[21]="\\dom-D\c$"
$Drv[22]="\\dom-D\d$"

;=========================================================================================
; If the Blat Email Program does not exist on the Current system and no reg key exists
; the system displays an error message and exit's.
;=========================================================================================
if existkey($blatregkey) <> 0
? "This script requires the commandline mailer BLAT."
? "You can DL it from http://kix.isorg.net/kix_tools/Blat.zip"
? "To install place in the path, and type"
? "BLAT -install <mailserver> <administrator email address>"
exit
endif
;
;=========================================================================================
; Start the Log file process if BLAT exists, and the database is found.
;=========================================================================================
;gosub STARTLog

gosub stdro
$TmpMsg = '+-----------------------------------------------------------------------------+'+$cr+
'|****************************** [ ATTENTION! ] ******************************|'+$cr+
'+-----------------------------------------------------------------------------+'+$cr+
"|Drive Check for Date: "+SUBSTR($FILL,25+LEN($DateAMER),55-LEN($DateAMER))+$cr+
'------------------------------------------------------------------------------'+$cr
;
;=========================================================================================
; Loop until all the Drives have been checked
;=========================================================================================
While $counter <> "" and $counter < 23
$DriveVar = $Drv[$counter]
$Result = GetDiskSpace($DriveVar)
$TmpVar = ' Drive $DriveVar has'
$TmpLen = Len($TmpVar)
If $TmpLen < 28
Do
$TmpVar = '$TmpVar$space'
$TmpLen = $TmpLen+1
Until $TmpLen = 28
EndIf
If $Result = 0
$ResultMsg = '+------------------------------------------------------------------+'+$cr+
' There is a Possible ERROR, Please Check Log for $DriveVar'+$cr
Else
If $Result < 1024
$ResultMsg = '$TmpVar: FREE (KB) = $Result'+$cr
Else
$Result = $Result/1024
$ResultMsg = '$TmpVar: FREE (MB) = $Result'+$cr
EndIf
EndIf
$TmpMsg = '$TmpMsg$ResultMsg'
$log = $ResultMsg
$counter = $counter + 1
Loop
$TmpMsg = '$TmpMsg'+$cr+
'--------------------------------------------------------------------'+$cr
del $tempfile
$nul = open(2,$tempfile,5)
$nul = writeline(2,$TmpMsg)
$nul = close(2)
;=========================================================================================
; Send an email to the Address's with in the $ccbase data file
;=========================================================================================
shell '%comspec% /c blat $tempfile -cf $ccbase -Subject "Drive Size Usage Report for $DateAMER!" -noh2 -q'
Exit


:Stdro
;=========================================================================================
; {Standard Subroutine}
; {Version .01}
; {03/07/2001}
;-----------------------------------------------------------------------------------------
; {FILES Required: None}
;=========================================================================================
$DateENG=SUBSTR(@DATE,1,4)+SUBSTR(@DATE,6,2)+SUBSTR(@DATE,9,2)
$DateDEF=@DATE
$DateAMER=SUBSTR(@DATE,6,2)+"-"+SUBSTR(@DATE,9,2)+"-"+SUBSTR(@DATE,1,4)
$SystNM=@WKSTA
$SystIP=LTRIM(SUBSTR(@IPADDRESS0,1,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,5,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,9,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,13,3))
$SystMC=SUBSTR(@ADDRESS,1,2)+":"+SUBSTR(@ADDRESS,3,2)+":"+SUBSTR(@ADDRESS,5,2)+":"+SUBSTR(@ADDRESS,7,2)+":"+SUBSTR(@ADDRESS,9,2)+":"+SUBSTR(@ADDRESS,11,2)
Return

Any help would be great. Thanks.

Top
#60333 - 2001-11-07 01:09 AM Re: Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


It does not work while it should (sounds pretty normal). Ok have in mind that several enviroment variables does not exist while scheduling ! If you replace
%temp% with c:\temp
%compspec% with cmd
your luck will change.

Top
#60334 - 2001-11-07 01:59 AM Re: Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


Changed the %temp% to c:\temp
Changed the %comspec% to cmd

Still getting the following

+-----------------------------------------------------------------------------+
|****************************** [ ATTENTION! ] ******************************|
+-----------------------------------------------------------------------------+
|Drive Check for Date: |
------------------------------------------------------------------------------
+------------------------------------------------------------------+
There is a Possible ERROR, Please Check Log for \\dom-A\C$
+------------------------------------------------------------------+
There is a Possible ERROR, Please Check Log for \\dom-A\E$
+------------------------------------------------------------------+
There is a Possible ERROR, Please Check Log for \\dom-A\F$
+------------------------------------------------------------------+

Could it be anything else?

Top
#60335 - 2001-11-07 04:39 AM Re: Can not get this script to work with WINAT.EXE
rfurman Offline
Lurker

Registered: 2001-11-07
Posts: 3
Loc: Chandler, AZ
I think I can help. I ran into this before. After the advent of Internet Explorer 4 or so, it changes/removes the Scheduler service. At the minimum it sets it to permanently run under the "System" account. Furthermore, it can not be changed to run under another account as most services can. This was all due as I said to Internet Explorer enhancements.. To resolve these issues Microsoft ha provided you with the "Scheduler" that is in Windows Explorer. Just start Windows Explorer and look for the "Scheduler" in the left window pane. You then can schedule any file to run under a particular username. You get these errors because the System Account does not have the needed permissions to access most if not all drives, shares and resources. Email me if you need help..

Rob

Top
#60336 - 2001-11-07 05:32 PM Re: Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


I have ran into similar problems using AT and Kix. You may just need to preface you scheduled command with CMD /C..

Therefore, your scheduled task should read "CMD /C C:\Scripts\kix32.exe c:\scripts\drvspc.kix". Does this resolve your problem?

Top
#60337 - 2001-11-07 05:39 PM Re: Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


No, that did not help either.....
Top
#60338 - 2001-11-07 05:51 PM Re: Can not get this script to work with WINAT.EXE
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Here are some Infos on the scheduled tasks problems I recently stated in a Scripts documentation , maybe there are some helpful hints for ya :

quote:

3. How to run the script scheduled

There are 2 kinds of scheduler services on current Microsoft Server systems - The old one (NT4,ie older than 5.0);
to be recognized by AtSvc.exe as the Service executable, and the new one, MS Task Scheduler; To be recognized by
existance of a control panel item ...
AtSvc.exe : on a command prompt type the appropriate at command and hit [ENTER]
ie. - AT 03:00 /interactive /every:M,T,W,TH,F,Sa,Su "c:\AdminScripts\Exch_Copy\exch_cpy.cmd"
Sets the scheduler to run the script (Package extracted to c:\AdminScripts ) at 03:00 am on a
daily base(recommended)
MS Task Scheduler : Create a new scheduled task and follow the Instructions !
(alternatively download the new jt.exe which replaces at.exe as commandline tool for the new
and improved MS Task Scheduler at www.microsoft.com)

(...)

6. Scheduled KiXtart Scripts and System Event 1312 !

As a design feature KiXtart enumerates some Client Information at startup !
one of these informations is the user name of the current user ...
If the Scheduler Service is set to run under the System Account (default) KixTart will (still)
log an event with the id 1312 containing information about failure of WKSTA_USER_GET_INFO ...
This System event can either be ignored (it doesn't influence the execution of the script in question)
or can be solved by running the Scheduler Service under a specific User account (To be set in Control Panel -
Services).
If you decide to run the Scheduler Service under such an account, make sure that it has at least Backup Operator
rights (better local or domain admin) and has the privilege to logon as Service (SE_LOGON_AS_SERVICE)


additionally i would recommend having the batch file just like this sample:

code:

@echo off
%0\..\[folder]\kix32 %0\..\[folder]\script.kix
exit

hmmm ... please correct me if there's something wrong ! Wrote that Documentation after 10:00 pm

Jochen

_________________________



Top
#60339 - 2001-11-07 06:37 PM Re: Can not get this script to work with WINAT.EXE
Anonymous
Unregistered


Thanks for the Responces. I have gotten the script to run, using the IE 5.5 Task Scheduler, and the modifications to the script, along with the batch file. So a little from everyone of the responces worked. Thanks again.
Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2870 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.029 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org