We help IT Professionals succeed at work.

Executing KIX batch file (includes shell commands) non interactively

Harps_Barfi
Harps_Barfi asked
on
837 Views
Last Modified: 2009-12-16
Yello experts,

Im using a kix script that automatically zips and copies an access database from a server , across the WAN, and to another server for backups.

Depending on whether or not the above shelled out command completed succefully Im sending out an email (using a command line mailer)

It all works fantastically well :)

w00t !

Now the problem.

I need the script to execute out of hours whilst the server is not logged in.

Servers are fully patched NT4 terminal servers (25 of them) the scripts and latest version of kix reside on the servers.

Like I said scripts are fine zip and copy is done using z7a command line zip utility and email is sent using clemail.

I then wrote a batch file to autoschedule the script to run

25 lines of :

AT \\servername 00:30 /every:M,T,W,Th,F w:\clemail\rota2ux.bat >>SCHED_LOG.TXT

rota2ux.bat is basically just a file calling kix32 rota2ux.kix

with rota2ux.kix being the kix script.

The "AT" scheduler adds all of the above quite happily and checking the server shows that the command is entered correctly into the scheduler.

However the script wont run when scheduled and I cant work out why. - Nothing in the script needs user intervention *confused*

Is it simply that "AT" is shite and I should be using something a bit more heavyweight (freeware recommendations would be nice)

or am I missing something ?

cheers for any and all help :)

\Harps
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018

Commented:
It's just that the at commands are executed in the local System context. This account doesn't have network credentials, so it won't be able to access any shared network resources on another machine.
There are two ways around it: map \\RemoteServer\ipc$ with a valid user name and password in the script before you start accessing the shared resources (and then delete the mapped connection afterwards), or use the Scheduled Tasks from the Control Panel to schedule the job (this was installed on NT4, I think with IE5.0). With the task scheduler, you can define an account that should be used to run the task.

Author

Commented:
Cheers for the comments oBdA,

Can I invoke scheduled tasks from the command line ?

Id rather not hardcode passwords into a kix script and I dont really want to touchbase on every server to add a line into the scheduler.

Regarding my above exaples - then fair enough the copy operation fails however I have error handling built into the script that upon a failuree the command line mailer still sends out a failure message relayed via SMTP.

Im pretty sure I dont need scredentials to connect to the SMTP server if im connecting from within the network.

I dont get any mails - it appears that nothing is happening

any ideas ?

\Harps
CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.