Solved

What is wrong with the attached code?

Posted on 2011-03-15
10
438 Views
Last Modified: 2012-05-11
¿I want to write a batch file that would copy a  .bak file  to a folder on a shared drive.
The code I tried is attached. I set it up to run in task scheduler. I get a success message, however nothing happens.
How can I edit this code to it will run correctly?

BTW- I use the  correct IP address in the code    Thanks
copy "F:\SharepointBackups\TESTcontentschedule.bak" "\\IPaddress\shared$\Backups\Sharepoint"

Open in new window

0
Comment
Question by:PDSWSS
[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
10 Comments
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144489
make sure you saved the password for the remote host
or add
net use \\192.168.1.199 /user:administrator passwd_of_admin
0
 

Author Comment

by:PDSWSS
ID: 35144559
Is this correct?

net use\\ipaddress\shared$\Backups\Sharepoint/user:administrator password
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144566
yes
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 5

Expert Comment

by:Khalid Mehmood Awan
ID: 35144583
You may use attached exe... I have been using it for years for synchronizing two folders on network.
But read its help by typing
SYNC /? when u are in its directory on command prompt.
 sync.exe
0
 

Author Comment

by:PDSWSS
ID: 35144589
Thanks. Concerns me to send my admin password in open text like that. Is there another way?

How would I save the password for the remote host instead?
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144615
net use  \\ipaddr\sharedir   /user:administrator  passwd /persistent:yes,
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 35144623
no need to add in the batch file
run net use /persistent:yes once on your machine
0
 

Author Comment

by:PDSWSS
ID: 35144636
Thanks. I'll test that. Run 1X in the cmd prompt. Correct?

Is there a way to encrypt the password?
0
 
LVL 6

Accepted Solution

by:
tangchunfeng earned 450 total points
ID: 35144672
run it in cmd prompt

net use  \\192.168.1.199  /user:administrator  /persistent:yes

you will be prompted for the password

no way to encrypt the password in the batch file as far as I know.

0
 
LVL 5

Assisted Solution

by:h4mi
h4mi earned 50 total points
ID: 35146029
For encryption you can make an Autohotkey script and compile it with a password phrase to make an .exe file that's difficult to decompile :

run, "net use \\ipaddr\sharedir /user:administrator passwd /persistent:yes"

download from www.autohotkey.com
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

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