?
Solved

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

Posted on 2011-09-28
3
Medium Priority
?
345 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
[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
  • 2
3 Comments
 
LVL 70

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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…
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 antispam), the admini…

771 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