Reports won't run in batch - dynamics-ax-2009

I am trying to run unmodified reports using batch processing in Microsoft Dynamics AX 2009. I have set up my configuration, and set up an AOS printer to run the report on. When I send a report to the batch queue, it immediately has an error when it begins execution.
The error is as follows:
Error executing code: SysGlobalCache object not initialized.
(S)\Classes\SysGlobalCache\get (S)\Classes\ClassFactory\reportRunClass
- line 14 (S)\Classes\RunBaseReport\makeReportRun - line 19 (S)\Classes\RunBaseReport\unpack - line 31
(S)\Classes\RunbaseReportStd\unpack - line 26
(S)\Classes\BatchRun\runJobStatic - line 27
I have tried running three different reports: Customer, Vendor, and Purchase Lines. I get the same error every time.
Any suggestions?

We faced a similar problem at my work, but didn't want to rely on having to set up the legacy batch processing method, suggested previously. Luckily in our case, it wasn't a requirement that the report actually be printed to hard-copy. So rather than try to send the report to a printer, you can run it to a file (ASCII, PDF, etc).
The batch server can process these, but since you'll need to specify a place to save the file, watch out for the following:
Be sure to use a UNC file path the path you wish to save to, otherwise you may get the following error: "Target file must be in UNC format."
Also be sure the necessary permissions have been applied to allow writing to that location, otherwise you'd get an error such as: "Unable to open file "

I believe the issue is that the batches are trying to process server code, and the reports are meant to run client side. Try the work around at this URL:
http://blogs.msdn.com/b/emeadaxsupport/archive/2009/06/16/how-to-run-client-batches-on-ax-2009.aspx
The gist is this, you create a batch group called "Client" or whatever, assign it to a batch server, then you run the legacy batch processor on the group. This might work for you.

Another option is to change the report to run on the server.
You'll need to check the menu item and make sure it's set to run on server.
It's a property on the menu item.
When you add a report to the batch, take a look at the batch inquiry screen.
Select the batch job - then click 'tasks'. If the task shows 'Run Location' = client, it won't run in the server-based batch framework.
Rob.

I was getting similar error. I restarted AOS and SQL reporting service and it worked all fine. Hope this helps.

Related

Batch script to block IP in windows firewall

I am creating a batch script to deal with the brute forcing through RDC on my server.
The way I plan on doing this is by making windows run my script when a failed RDC is logged in windows security log. I will add a whitelist to prevent trusted IP addresses from being blocked. It will also log how many times the IP has tried to login, and if it fails more than 5 times in a row, it will be blocked.
Problem is, I don't know how to pass the IP from the logged event to the batch script.
The Windows Server 2008 R2 event viewer has an ability to start a program when a specific event (With a event number) occurs. It has a box for arguments that can be passed onto the program that I can specify (which will be this batch script). However, It does not specify what arguments it can pass on (I want the IP to be passed onto the batch script... that is all).
Any help would be greatly appreciated.
I managed to fix it myself, using this. I adapted the one he had over to include $(IpAddress) and got it working after a bit of mucking around.

VB6 application keeps lock on Access (.mdb) database after creation, causing an error 3028

Our application builds an Access database (.mdb) and then starts a different application with the Shell command which needs Read/Write Access to this very database. The problem is that on some systems our application seems erratically to retain an exclusive lock on the database, preventing the other application from accessing it. Only after closing down the first application can the other application proceed.
The specific Error that is raised is Error 3028, which seems to be specific for DAO 3.51 (Access '97) which we indeed employ. I cannot understand why some systems are affected (and then not consistently) and others never. I thought that it might be a timing issue and built in a Sleep period between building the database and launching the other application, but that does not help.
What is going on?
EDIT:
I now created a workaround by creating the database in a separate file and then copying it. Now the second program should always be able to access it and any remaining lock problems will surface in the first program, which I maintain. I will follow up later when our users have been able to test this.
Are you closing the connection to the DB before passing control to another EXE?
I had a similar issue previously which wasn't quite the same but from what you have described this is the approach I would try:
Before lauching the secondary application with the shell command.
Alongside the sleep period you have already employed you will also need to close the original program which generated the .mdb file.
I achieved this by shelling a windows batch file, and then immediately exiting the original program.
Batch file makeup as follows:
ping -n 5 localhost >NUL
start MSAccess.exe "C:\DB.mdb"
exit
This allows 5 seconds for the mdb file to be freed-up before launching, you could replace my Ms Access call with your secondary program.

Batch file called by scheduled task throws error when scheduled, runs fine when double clicked

I have a batch file that maps a networked drive. About a week or so ago the password expired, so the program calling the batch file started throwing errors.
I've updated the password in the batch file, and when I double click on the batch file, the drive maps fine. However, when the scheduled task kicks off, I get the following error:
Logon failure: unknown user name or bad password.
Anyone seen this before? I've tried recreating the scheduled task, but it doesn't seem to make any difference.
EDIT
I've updated the properties of the scheduled task, which isn't the problem. The problem seems to be the username and password in the batch file. The strange thing is if I log on interactively and double click the executable, everything works perfectly.
The last time the job ran it threw a "semaphore timeout period has expired" error. I've never seen this particular error before, but it seems like it was actually logged on and trying to copy files when this happened.
EDIT
I've revised my code to make it as simple as possible. I'm using a batch file to map the drive, then using code to transfer the files. I still run into the same issue - it works fine when I double click the batch file, but once I throw Scheduler into the picture, it throws a "Bad username or invalid password" error.
Occasionally when I'm trying to run the file by double clicking on it, I get a "Could not find part of the path" error. This says to me the drive mapping actually worked but something failed when it was trying to copy. (Most of the time, testing by double clicking works fine)
The username and password associated with the task when you created it is no longer valid or has changed.
This occurs generally when creating the task and forgetting to select the option not to store the password. When your password is set to expire, then you will meet this problem everytime you will have to reset your password. Make sure to do as on the image :
It sounds like the username and/or password associated with the scheduled task is no longer correct. The batch file is likely OK, you just need to change the properties of the scheduled task.
I ran into something similar while testing a new powershell script we wrote to create a scheduled task to back up to one or more network locations. I had to go through a number of iterations, and when I decreased from two network locations to one, the scheduled task stopped working, with individual steps in the called script giving "Logon failure: unknown user name or bad password" errors, though when I copied the arguments and ran them from the command line they worked.
After reading this question and Tim's comment, I tried deleting the scheduled task and re-creating it. After that it worked. I would concur that the scheduled task likely cached something.
From:
https://danblee.com/log-on-as-batch-job-rights-for-task-scheduler/
Go to the Start menu.
Run.
Type secpol.msc and press Enter.
The Local Security Policy manager opens.
Go to Security Settings – Local Policies – User Rights Assignment node.
Double click Log on as a batch job on the right side.
Click Add User or Group…
Select the user and click OK.

Printing from an application in IIS to a networked printer on server

I have a line of code that I can run locally as part of a service that works perfectly fine.
sReportPath = objCrystalUtils.ExportReportToPDF("Report Name", iReportInfoID)
This code is run as a part of a service, and when I unit test it by feeding it data, it ultimately builds the report and prints it.
When I run the exact same piece of code inside an .ashx from an ajax call. The reports are generated (I can see the pdf files being created on disk) but the printing is not happening.
oRpt.PrintToPrinter(objReport.DefaultAutoPrint, True, 0, 0)
In both scenarios the same code is used to print the report. (objReport.DefaultAutoPrint = 0 in both cases)
My only thought is that the location of the code that is calling this method is in a different spot relative to the location of the bills themselves.
The printer that I'm trying to print to is a network printer intalled on my machine, and I'm running Windows 7 IIS 6.1
Any thoughts?
Edit:
Here is a thought... if I'm running one as a unit test locally and im running the other through a web app that is running via IIS, is there a difference in user id and user access to the default printer?
Edit:
So I added my local ASP, IUSR and SYSTEM users to the printer security and allowed them to print... no dice. So I checked the EVERYONE user and it is set to access and NO users are denied... so I think that kinda kills that line of reasoning.
Edit:
I changed the name of this post since I no longer think that the issue is ajax related since If I try to do the same process in code bebehind from a post back instead of running it from an ajax call i still get the same problem.
Patrick, for me it is a known issue of crystal reports, printing a certain report from a running application via IIS.
I got the same issue before, and upon our search for that issue, we got the following;
Report to be generated, exported, and then to be downloaded to client machine,
so user can print it locally (say, report will be exported as PDf file,
user can use print option of PDF reader).
It's not Crystal Reports or other third party app's problem. It's usually the IIS_IUSER's permission problem because it has no access to any network printers. A possible solution is in Process.Start doesn't work in IIS

How to open a logfile in windbg from a script, such that each logfile is named by the timestamp of creation?

I want to run a windbg script that will accomplish the following:
I want to track certain registers the moment an API is hit, without stopping due to timing issues. So , the moment the API is called, I want the script to open a logfile, echo the fact that the api is hit with the details of the parameters, and let it run till it hits the conditional brkpoint I've put at the API end, which simply closes the open logfile.
Now , the problem is, I want to do this multiple times, w/o the previous logfile getting overwritten. Ideally, if there is some command which lets me specify that the name of the logfile (.logfile file) by the timestamp of that moment, my problem is solved.
Can anyone help?
Pretty easy:
I'll have to use .logopen /t filename - what a no-brainer :)

Resources