Solved

DOS Script for batch

Posted on 2013-01-10
14
515 Views
Last Modified: 2013-01-18
Need to deploy a backup script to many workstations such that they could schedule to backup the chrome file , which is located under

From (local) : %userprofile%\Local Settings\Application Data\Google\Chrome\User Data\Default

To : U: (mounted drive)


Is it possible put deploy a script such that when a user double click on it, it will be scheduled on their Window XP or Window 7 and backup daily at night ?

Tks
0
Comment
Question by:AXISHK
  • 7
  • 5
  • 2
14 Comments
 
LVL 13

Expert Comment

by:imkottees
ID: 38765647
0
 

Author Comment

by:AXISHK
ID: 38765650
Thanks. but we want to deploy a batch file to automate it, rather than asking user to do this by themselves. Any advise ?

Tks
0
 
LVL 13

Expert Comment

by:imkottees
ID: 38765663
the article says how to schedule a task, no user interaction needed.. you can set the time and what to run.. it will run automatically, make sure machine is up by the time

to push batch file through gpo:
http://www.jasonpearce.com/blog/2010/11/17/deploy-software-via-group-policys-scheduled-tasks/

I.E: http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/
0
 

Author Comment

by:AXISHK
ID: 38765669
Understand but the users will not go through these steps by themselves... need the most easiest way such that a user just doube click on the file and schedule the backup task on the Window system...

Tks
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 38765715
In the BAT file you can use SCHTASKS to schedule the execution daily. What do you want to execute?

http://ss64.com/nt/schtasks.html

~bp
0
 

Author Comment

by:AXISHK
ID: 38765782
Want to copy the following source folder to our network drive U which is mounted to the user's personal file.

The sript need to identify the environment variable - %userprofile%
 
From (local) : %userprofile%\Local Settings\Application Data\Google\Chrome\User Data\Default

To : U: (mounted drive)

Tks
0
 

Author Comment

by:AXISHK
ID: 38795440
I've requested that this question be deleted for the following reason:

No further feedback.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 52

Expert Comment

by:Bill Prew
ID: 38782440
Try using the following BAT file.  It will schedule a job that just executes XCOPY.EXE to copy the users files. You may want/need to adjust some of the XCOPY command options, or the SCHTASKS options. I tried to show an example that runs every day at 18:00 hours (6:00 pm).

(Notice that SCHTASKS requires embeded double quotes in the command line that you want to schedule to be escaped with a backslash.)

@echo off
schtasks /create /tn "Nightly Usewr Backup" /tr "xcopy \"%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\" \"U:\\" /s /i" /sc daily /st 18:00

Open in new window

~bp
0
 

Author Comment

by:AXISHK
ID: 38790313
Return with Invalid Syntax. Mandaytory otpion '/sc' is missing.

Any idea ?

Tks
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 38790367
Sorry, forgot that "\" has to be escaped to "\\", so this will work:

@echo off
schtasks /create /tn "Nightly Usewr Backup" /tr "xcopy \"%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\" \"U:\\\" /s /i" /sc daily /st 18:00

Open in new window

~bp
0
 

Author Comment

by:AXISHK
ID: 38790443
After breaking the long command, I see a additional "\" between the xcopy ? Any idea ? Is that correct ?

"xcopy \"
%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\Default\*.*\
" \"
U:\\\
" /s /i" /sc daily /st 18:00



2 mininal issues.

1. is it possible to execute the batch remotely from the server as it asked for the password, normal users don't have that right ?

2. Is it possible to remotely start the Task Scheduler service ?

If no, I will mark the question and try to post the question in another topic.

Tks again.
0
 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38794230
The SCHTASKS command I posted last had correct format, I tried it here and it worked without error, adding a scheduled task.

There are some add on tools that can allow remote execution of a BAT file on another machine, but they come with some other tricky setup and limitations.  PSEXEC is one of these, at http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx.

~bp
0
 

Author Closing Comment

by:AXISHK
ID: 38795441
Tks
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 38795618
Welcome.

~bp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

17 Experts available now in Live!

Get 1:1 Help Now