Jump to content

How to run SIMS sims reports from a sheduled batch file


Recommended Posts

Posted

I am trying to schedule the running of several SIMS reports that output xml to a folder.

Because there are about 9 reports I want to put all the commands to run them into a batch file and schedule the batch file.

However, although the command INSIDE the batch file works correctly I cannot seem to get the batch file to run correctly without modification and even then I cannot get Windows scheduler to run the batch file.

 

To be specific; This is a line to run one the reports (with personal details changed)

 

"\\4666sims01.myschool.local\e$\Program Files (x86)\SIMS\SIMS .net\CommandReporter.exe" /user:fred /password:thepassword /report:"StudentList" /output:\\4666fs01.myschool.local\staff share$\simsexports\students.xml

 

Entering this line into a command prompt window works fine, the report is run and the export file gets created.

But when I put that exact line into a batch file called mybatch.bat on drive C: (same as \\4666fs01.myschool.local\) and tried to run the batch file via the command prompt it did nothing. A quick flash of the screen but no report is run, no error messages, nothing

 

Playing around, I put into the batch file the extra line '@echo', (even though this shouldn't make any difference) so the batch file contents became

 

@echo
"\\4666sims01.myschool.local\e$\Program Files (x86)\SIMS\SIMS .net\CommandReporter.exe" /user:fred /password:thepassword /report:"StudentList" /output:\\4666fs01.myschool.local\staff share$\simsexports\students.xml

 

and now the batch file ran correctly from the command prompt, the sims report was run and the output was produced.

 

Whoopie I thought!

 

However, I then tried to use the Windows task sheduler to run the same batch file from the same location instead of running it by hand.

Once again nothing happened, not even a flash on the screen this time. The task scheduler simply says 'running' forever until I kill it.

 

We are running Server 2013 and windows 8.1

 

Can anyone help me to create a batch file that can be scheduled to run several sims reports?

Posted

Does it stay running forever, as you say, or has the screen just not refreshed?

 

I had this several times but pressing F5 shows that the task has actually stopped.

 

On 2008 R2, you need to run the task with either 'highest' security, or for 'server 2008' - I can't remember which it was I had to set last month.

Posted

Which user runs the task? Check privileges and also the privileges options on the task.

Perhaps try sending the output to the sims server first to test.

Also check the logs, not sure if they are updated if you break out, so maybe set a timeout on the task then the logs may give you an error when it fails.

Posted

The system admin technician was logged in running the task so he should have full rights over the server and we were setting the task to run with admin privileges.

I can try sending the output to the sims server but that ought not to be an issue as the batch file works fin on its own using the two server paths.

@Howatp yes, we tried refreshing. we were also looking at the folder where the output goes and refreshing that every second or so but the new xml file was never created.

The logs indicate that the task started but never stopped

Posted

Add a pause command to the end of the batch file script and check the output of CommandReporter in the console.

 

Also, on machines with UAC enabled, we have to Right Click -> Run As Administrator (even with admin rights)

Posted

But if you have to right click manually doesn't that prevent using the scheduler?

 

I'll try pause as I saw that in other posts here but tended to ignore it as Pause by itself doesn't really make any difference to the operation of the command line, but I can see why you suggest it

Posted
But if you have to right click manually doesn't that prevent using the scheduler?

 

I'll try pause as I saw that in other posts here but tended to ignore it as Pause by itself doesn't really make any difference to the operation of the command line, but I can see why you suggest it

 

Our scheduling works, but just double clicking the batch file gives us an error without 'Run as Administrator'

 

Adding the pause will allow you to see the console window without it flashing off, obviously when you have it working - Remove this!

 

We've had a few requests for creating these schedules/batch files/custom reports etc. which was the main reason I am developing this:

 

exporter.jpg

 

Once I've done with it, you're welcome to it. It's basically a front-end + hooks into Windows scheduling for running CommandReporter, with the addition of running batches of reports and saving too.

Posted

That looks very cool! I'd love a copy when you're happy to release it - even half finished if it gets the batch file bit right!

 

I was just about to give up and write a compiled executable in delphi that would run a command shell to call commandreporter in a loop with the reports as parameters

that way I could avoid the batch file altogether and schedule my exe instead. But I'll wait for your app first.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...