?
Solved

Cannot get VBScript to run as schedules task

Posted on 2016-10-17
10
Medium Priority
?
61 Views
Last Modified: 2016-10-19
I cannot seem to get a VBScript to run as scheduled task on Windows Server 2012 R2. From the task properties window I can see that the task runs as scheduled but the script does not appear to execute. The script is supposed to copy folders from the server to a NAS. The task runs but the folders are not copied.
I have tested the script extensively so I know it does what it is supposed to when run from the desktop.

Any suggestions would be appreciated.
0
Comment
Question by:lloving
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 41846517
This could be a permissions issue, where the account running the script does not have access to either the source or destination folder.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 41846565
What options or configuration did you use in the scheduled task setup?

I would also suggest logging some debugging information from the VBS script when it runs to a text file, so that you can better diagnose what executed and what didn't in the script and information that might help you see a problem.

~bp
0
 

Author Comment

by:lloving
ID: 41846888
Thanks for the quick reply.

The account running the scripts and the account scheduling the task are both the System Administrator for the server. The task is running with all privileges.

I will test again with some debugging script but I am pretty sure the script never runs.
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:lloving
ID: 41848118
I have done some more testing. I put a MsgBox in my script to display at the beginning of the script and one at the end. Neither show up. Looks to me like the script never runs.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 41848688
In Task Scheduler, for the scheduled task you created that isn't running, what does the activity log for that specific task show?

Also, can you share some screen shots of the configurations screens for that scheduled task, we might see something that isn't correct or might cause a problem.

~bp
0
 

Author Comment

by:lloving
ID: 41848734
i found the problem I think. When the task runs it does not know what program to use to run the script. The extension on the script id .vbs. Should I change it to .cmd or .bat?

Thanks
0
 
LVL 56

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 41848747
I would recommend specifying the program to run it as CSCRIPT.  So make that the executable you run, and then pass it the VBS file name.

~bp
0
 

Author Comment

by:lloving
ID: 41848761
Ok, I'll report back after testing.
0
 

Author Closing Comment

by:lloving
ID: 41850043
Thanks Bill. That was the key.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 41850092
Great, glad that was helpful.

~bp
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question