Solved

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

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

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

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

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
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…
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…

749 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