Solved

Cannot get VBScript to run as schedules task

Posted on 2016-10-17
10
46 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

785 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