Thursday, 19 April 2012

Issue with scripts\scheduled tasks on Server 2008 that use Excel or Office I had a problem yesterday scheduling a task to get some data and create an excel file on 2008 R2 Server L1UKASP26. The script ran perfectly on my PC, and also ran perfectly on the server if you double clicked it, but didn't run as a scheduled task. After troubleshooting the task settings, I worked out that it would work if you selected "Run only when user is logged on" (so like "Interact with the desktop" in previous Windows versions), but fail if you selected "Run whether user is logged on or not". After a while searching for ways around this, I came across the below article, which basically says that Office apps need a %profile%\desktop folder to work, and when running in 'headless' mode with 2008 Server, there isn't one. The fix, they said, is to create a couple of empty desktop folders. Surprisingly, this fixed it! If I had used Sysinternals process monitor (http://live.sysinternals.com/procmon.exe) to look for failed file accesses, I might have worked this out myself ;*)

No comments:

Post a Comment