Sheduled task() not working in Server2008

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
krishkri
Posts: 9
Last visit: Wed May 30, 2018 7:24 pm

Sheduled task() not working in Server2008

Post by krishkri »

Hai all,I have a sheduled task configured in windows 2008 server (SP 2).If i enabled that task as 'Run Whether user logged in or not".My task not working properly.Using the task i am tring to create a excel file and to save at location. I have admin privelage on the server. (Excel version 2007). once task completed i can see the EXCEL.exe*32 in process tab of Task manager.Here is the VBSccode that i am using. Pleasse help me.
==== Code ==========Set objExcel = CreateObject("Excel.Application")Set objWorkbook = objExcel.Workbooks.AddobjExcel.Application.DisplayAlerts = trueobjExcel.Cells(1, 1).Value = "Test Excel"objExcel.ActiveWorkbook.SaveAs "D:example.xls", 56objExcel.ActiveWorkbook.Close objExcel.Application.Quit=======
User avatar
krishkri
Posts: 9
Last visit: Wed May 30, 2018 7:24 pm

Sheduled task() not working in Server2008

Post by krishkri »

Thanks for your help.
But it works only if i looged in. If i enabled option 'Run Whether user logged in or not" It's not working.i can see the EXCEL.exe*32 in process tab of Task manager.



jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Sheduled task() not working in Server2008

Post by jvierra »

YOu cannot run office applications without a user interface. This is by design and is well documented. SOmetimes some things will seem to work but mostly it won't work.


If you think it will work then be sure it is running under an account that is allowed to access teh disk location you are using.

jvierra2009-12-11 12:11:13
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Sheduled task() not working in Server2008

Post by jvierra »

I just ran marcos version of the code and it run correctly. I set it to run with full profile and without the user logged on. YOu problem is probably permissions from teh acccount you are using for thetask. Try using an admin account to see if it is a permission problem.

User avatar
krishkri
Posts: 9
Last visit: Wed May 30, 2018 7:24 pm

Sheduled task() not working in Server2008

Post by krishkri »

Hai,

Thanks for your response.

I didn't get what exactly you mean by "teh disk location".
I have admin access to the server and the target disk location where script try to save the document. I sheduled the task with my credentials.

If I enabled the option "Run only when user logged in" in task and if i loogged in; Sheduled task and script works perfectly fine.


User avatar
marcogsp
Posts: 16
Last visit: Wed Jan 06, 2010 12:21 am

Sheduled task() not working in Server2008

Post by marcogsp »

Would the target disk location be a mapped drive? Does the drive get mapped when your account logs on? If so consider editing the the target location to be a UNC location and re-examine your share level and security tab permissions.[

code]objExcel.ActiveWorkbook.SaveAs "ServerSharenameexample.xls", EXCEL8_FORMAT[/code]

You could also have the script temporarily map a drive, write the file, and then unmap the drive.

Code: Select all

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "D:","ServerShare" 'Map Drive

objNetwork.RemoveNetworkDrive "N:" 'Unmap Drive
Can you run the task under some other privileged account and/or write to a different location and see if it succeeds? All the clues you have given us still seem to point to either a permissions issue, or missing resource issue. You could also export the task to an XML file and post it here. Be sure to examine the XML file to make sure it contains no sensitive info. With the XML file, we can do a test import of the task and see how it is constructed.

In the meantime, I will try to duplicate my results on a Server 2008 configuration.

By the way, "teh disk location" represents an online forum use of slang. People who use the "hunt and peck" method to type often misspell the word "the" with "teh". The misspelling has found it's way into the way many Americans intentionally type their text correspondence. It is just another example of how the English language is growing. I'm sure many American's would find English slang expressions that have developed in India just as confusing.
User avatar
krishkri
Posts: 9
Last visit: Wed May 30, 2018 7:24 pm

Sheduled task() not working in Server2008

Post by krishkri »

THANKS marcogsp,

Reported issue resolved now. I tested this yesterday itself as per Ogawa's suggetsion in followng link.http://social.msdn.microsoft.com/Forums ... 818ef91.(I was about to reply on the same.) Today my shedlued job run succefully with out any issues. I created one more folder in C:WindowsSystem32configsystemprofileDesktop.
Thanks a lot for your valuable suggestions and quick response.
Really appreciated.
This topic is 14 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked