Solved

Cannot get VBScript to run as schedules task

Posted on 2016-10-17
10
50 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
  • 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 53

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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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 53

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 53

Accepted Solution

by:
Bill Prew earned 500 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 53

Expert Comment

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

~bp
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

828 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