Solved

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

Posted on 2011-09-28
3
336 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

Does Powershell have you tied up in knots?

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

Question has a verified solution.

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

Suggested Solutions

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

943 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

10 Experts available now in Live!

Get 1:1 Help Now