Solved

How do I use Power Shell to execute code in windows scheduler

Posted on 2011-09-28
3
335 Views
Last Modified: 2012-05-12


I've got the code to do a ROBOCOPY pulling a folder and all sub-folders and files. I just don't know how to get Power Shell to execute the code using Windows Scheduler on Server 2008 R2. I'm using Task scheduler on the server to setup a scheduled backup from the client machine to the server

Here is my code:

ROBOCOPY \\aegis-pedge\C$\"visual studio 2010" D:\NASShare\"visual studio 2010" /E

It works like a charm when i open Power Shell and run the command. How can i automate this to work with Windows scheduler?

As Always Thanks in Advance EE!
jpertchik
0
Comment
Question by:jpertchik
  • 2
3 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 36718968
For that simple command PowerShell is too much. Just stick with the command itself - you can use that as above, just put into a task's commandline.

BTW, double quotes should always surround the complete path, not only fragments like the file name. Using double quote in-midst of the path can have unpredictable results. So your task command line should sound:
robocopy "\\aegis-pedge\C$\visual studio 2010" "D:\NASShare\visual studio 2010" /E

Open in new window

0
 

Author Comment

by:jpertchik
ID: 36719324
OK, that sounds like a plan. However i cannot do the deed until after noon EST. I'll let you know how it pans out.

Thanks for your comment.
0
 

Author Closing Comment

by:jpertchik
ID: 37059067
Great advice! Thanks EE!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now