Tuesday, April 19, 2011

How to schedule Dynamics GP to automatically log in and run an Integration Manager integration - revisited

With my newly found stride, thanks mostly to Microsoft Dynamics Convergence Atlanta 2011 and the number of interesting questions I fielded during the event, I thought it was time to revisit the issue of scheduling Integration Manager integrations as part of our deep dive session, DDGP03 Microsoft Dynamics GP Customization & Integration Tools Review - see Microsoft Convergence Atlanta 2011: Day 3 for more on what transpired that day.

If you have been a follower of my blog for sometime now, you will recall that back in January of 2009 (ok, I don't expect you to remember this) I posted an article on the subject - see How to schedule Dynamics GP to automatically log in and run an Integration Manager integration. In short, the article looked at using the Windows Task Scheduler to launch a batch file, which in turn would launch Microsoft Dynamics GP, which in turn would use a macro to log into the system, then run a previously created shortcut to run the integration...in summary, a very complicated set of steps if you ask me. This method also presented a problem for users running Windows Server 2008 and above, since the Windows Task Scheduler no longer supports desktop interaction, which is required by the macro system to execute a macro.

Fast forwarding one year and almost half later, and I still get this question regularly: How can I schedule an Integration Manager integration?

Here is my new secret...

I use a (non-Microsoft) product called System Scheduler Professional by Splinterware. It turns out that System Scheduler has no ties to the Microsoft Windows Task Scheduler - none whatsoever! In turn, it allows the product to do some really cool things like running as a service application which is just exactly what's needed if you are going to schedule stuff when locking down your computer before leaving for the day is a must.

System Scheduler - Event Setup

System Scheduler allows you to setup an event or a list of events to be executed and even more cool, it allows you to send key sequences to an application with a complete help file that illustrates what's possible. In older systems (like Windows XP) you can even set it up to unlock the computer and lock it as part of the list of events. Due to restrictions in the way Windows 7 is built this is not possible, but still, not needed if you consider that System Scheduler can run as a service under the LocalSystem account or a named account.

System Scheduler - Advanced Options
You can download the product with the link below:

System Scheduler Professional by Splinterware.

The Professional version allows you to try it out for 30 days before you need to register it. It is really very simple to use and if you had had any exposure to Windows Task Scheduler then this should be a breeze. Now, instead of the complex steps mentioned in the previous article, you can schedule Microsoft Dynamics GP to launch with the typical parameters and use a macro to log you in (if not using Microsoft Dynamics GP 2010 to remember the user and company for you). Once GP is up and running, you can use a the SendKeys function to lunch IM (or IMRun) and execute the integration of your choice.

As it turns out, you can also have a multi-event schedule that first launches GP then launches IM with the integration as a parameter. Please try the tool out and let me know what you think.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

19 comments:

Anonymous said...

An interesting post.

I was directed to your post by a Microsoft support technician after having repeated problems running an Automated Integration against the latest versions of GP. This has never been a problem in the past, but seems to be getting more and more difficult and soon to be dam near impossible if running under Windows Server 2008.

One issue your blog doesn’t address is the issue of logging out of and then into another company. I’ve automated GP in the past before the AutoDim tool came onto the scene, but the issue has always been switching companies once the integration has completed. The AutoDim tool resolved those issues. How does this scheduler resolve those issues, or is it simply a case of using the scheduler to launch the batch file that still uses the AutoDim tool?

Anonymous said...

I love the tool and your tips. But I am having an issue with it. I can run a task the exact same way three times and get three different results. I have a macro that runs the AR Aging process. I can run the task, and GP opens, the aging process runs, and GP closes. Then I can run it again, and GP opens the aging process runs, but GP doesn't close. And finally (and unfortunately this seems to be the most frequent), I can run it again. GP gets to the login screen and stops without ever entering my password. Finally I get a box labeled Add-in Initilization Error. It has a lengthy message that starts with "Microsoft.Dynamics.GP.OnlineServices.dll: unable to get valid config from serialized string. Client proxy can not be configured properly...."

I have noticed at this client that sometimes when I open GP, it takes forever before I can click in the password box and enter my password. Prior to that, the window doesn't even seem to be active. I wonder if this is causing the hang. Any ideas? Thanks!

Anonymous said...

Follow up to 5/4/12 post - I am using System Scheduler to run the macro. If I manually run the System Scheduler task, it seems to be running fine now; I've run it several times today, and it has not failed at all. But it will NOT run if I schedule it and log off the server. It leaves dynamics.exe hung in task manager processes, and it has this error in the macro log file:

:C:Program Files (x86)/Microsoft Dynamics/GP2010/data/AgingCAN.mac Started 05/08/2012 11:27:41
:C:Program Files (x86)/Microsoft Dynamics/GP2010/data/AgingCAN.mac Aborted 05/08/2012 11:27:41
:C:Program Files (x86)/Microsoft Dynamics/GP2010/data/AgingCAN.mac Elapsed 0:35 Last Line 4
Error: Field on window is inactive or disabled.
Last Line: 4
Line: MoveTo field '(L) SQL_DataSource' item 2 # 'GP2010'
Location: dictionary 'Microsoft Dynamics GP' form Login window Login field


I don't understand what that error means. Not sure how to change System Scheduler to get it to run when I'm logged off.

Any ideas? Thanks!

Mariano Gomez said...

Make sure you are setting up your Logon Keypresses under Preferences to unlock the computer before the integration runs. That's the only thing I can think of.

MG.-

Sherry said...

I checked with Spliterware Support. Here's what they said:
According to the link you sent over, it seems that in order to login GP needs to be able to interact with the desktop - so this wont work while the computer is logged out or locked.

System Schedulers own built-in sending keypresses works in the same way.

So I'm just not sure this works :(

Mariano Gomez said...

Sherry,

Thanks for the update. I will post back with my findings, however, I have this working at a few clients and so do some fellow MVPs who actually directed me to this product.

All environments are different and there may be some settings that need to be changed in yours for the product to work.

MG.-

Anonymous said...

Windows SErver 2008R2. Still having issues. If I am physically logged into the desktop, the schedule runs fine. If I am not physically where I can see it - it does not run - stops at the point it should be entering the password to login. I have tried the auto logon and the keypreses and no luck. Don't feel that I understand the keypresses. Any additional help?

Mariano Gomez said...

Anonymous:
As I said before, Windows Server 2008 does not support desktop interaction anymore. So, being logged in with the desktop open is your only choice.

MG.-

Josh Miller said...

Mariano,

Thank you for posting this article. I have read it a few times, and read all comments. I was hoping you could answer my question regarding an integration. I would like to schedule an integration on a 2008 R2 server with Dynamics 2010 installed to log in and to run un-attended. It sounds like that can not be done. Is the work-around then to 'log in' to the server (via remote desktop) when the integration needs to run? In the last comment reply you mention that 2008 does not support desktop interaction. In other words, even with the System Scheduler Professional software, you would physically need to log into the machine to run the macro. Correct? Is there another way, or is this still the best approach. Thanks for your Blog!

Mariano Gomez said...

Josh,

Unfortunately, you will need to be logged into the server (not remotely, but at the console) to be able to get your integration to run with Integration Manager and Windows Scheduler.

If you want a 'schedulable' integration, you will need to use eConnect rather than IM. eConnect can be added as part of a Windows Service (that you develop) for scheduling purposes.

Sanjay Kumar Rajarao said...

Hi Mariano,

It would be nice if you can add a update note for the applicability with regard to GP 2013.

Thanks!
Sanjay

Sanjay Kumar Rajarao said...

Hi Mariano,

Are there any updates to this blog post with regard to GP 2013.

Thanks!
Sanjay

Mariano Gomez said...

@Sanjay:

Not sure I will cover this for GP 2013. There are a host of tools that facilitate these types of scheduled integrations without the complexities associated with doing so with Integration Manager. I suggest you look at SmartConnect from eOne Business Solutions or Insight from Scribe.

MG.-
Mariano Gomez, MVP

Crystal Clear said...

Hi Mariano -
I'm using splinterware to start gp and run the integration for gp 2013. I created a batch file and have splinterware run the batch file. I did need to add timeout /t 90 before the integration starts.
Now I need to get the splinterware to log out of gp. Any idea? Thanks
Crystal

mitch161 said...

All the AutoDIM posts begin after AutoDIM starts running. I have set up the AutoDIM.txt file with the macro, the IMrun, etc., but when I try to run AutoDIM.exe, nothing happens. What am I missing?

Robyn Evans said...

Hi Mariano,

I have a macro written that logs into GP and creates my safe pay file. The bat file that i am using to do this run beautifully. Then i tried to create a SSIS tasks that would dynamically run the bat file based on whether a file was needed today or not. That also works great if I run the task in Visual Studio. It also works great if manually execute in my SSIS catalog. If i run it through a job it fails - the macro is getting stuck at the login. If take the bat file and put it in just a scheduled windows task, it gets stuck in the exact same place. Again manually runt he bat of the ssis and it is fine. Below is the error. It is like GP is so launching and not yet made it to the first field on the window so it cannot go any further. The macro action when i manually run it waits for it to be active to move further. Very very perplexed. Really need to get this Safe Pay automated so users are not responsible for creating the file. Thanks in advance for any guidance you can give.


:C:Program Files (x86)/Microsoft Dynamics/GP2015/TestSafePay.mac Started 06/01/2015 19:41:53
:C:Program Files (x86)/Microsoft Dynamics/GP2015/TestSafePay.mac Aborted 06/01/2015 19:41:53
:C:Program Files (x86)/Microsoft Dynamics/GP2015/TestSafePay.mac Elapsed 0:05 Last Line 3
Error: Field on window is inactive or disabled.
Last Line: 3
Line: MoveTo field Password
Location: dictionary 'Microsoft Dynamics GP' form Login window Login field

Robyn Evans said...

I changed my scheduled task to be configured for Windows Server 2012 R2 and it will now manually run as well. Just when i am not actively on the server it bombs. We have tried System Scheduler before and had the same issues. Any other alternatives...

Robyn Evans said...

I was able to get the task to run by changing the Configure for option to Windows Server 2012 R2. Now i am left with the issue that it will not run unless i am actively logged in. This will not work. We have tried System scheduler before and it had the same issues but that was on 2008 server. Do you think that would solve my issue or any other suggestions?

Mariano Gomez said...

Robyn,

You are spinning your wheels. Desktop interaction was deprecated in Windows Server 2008, so no, it's not possible to schedule this without being actively logged into your server.

MG.-