?
Solved

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

Posted on 2011-09-28
3
Medium Priority
?
348 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 71

Accepted Solution

by:
Qlemo earned 2000 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

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

850 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