PowerShell script exchange
Post Reply
gcanales
Novice
Posts: 9
Liked: never
Joined: Feb 24, 2013 6:51 pm
Full Name: Gilberto Canales
Contact:

"File Copy" Job cmdlet

Post by gcanales »

Hello,

A customer discovered the file copy jobs and asked me to create jobs to backup some local files in a few non-virtual servers and importants PCs. Almost 30 :shock:

Immediately thought in using Powershell to create those jobs, took a good look on the documentation, but I could find the cmdlet to create "file copy" jobs. Is there any? Please tell there is one.

Custo has B&R 7.0 R2 latest patch up to today installed.

Thanks
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: "File Copy" Job cmdlet

Post by Vitaliy S. »

Hi Gilberto,

I'm not a PowerShell expert, but I believe you should be using this cmdlet - Add-VBRCopyJob (which can be used to create VM and file copy jobs).

Thanks!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

More information regarding this commandlet can be found here.
benc
Novice
Posts: 5
Liked: never
Joined: Mar 02, 2014 12:11 am
Full Name: Ben Castellucci
Contact:

Re: "File Copy" Job cmdlet

Post by benc »

Hey Gilberto, did you ever manage to come up with the proper command line for this? I would be interested in knowing...

Thanks!
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

Hi, Ben, as mentioned above, the cmdlet that should be used here is Add-VBRCopyJob. Can you elaborate on what particular issues (if any) you have faced while using it? Thanks.
PNWMtnBiker
Enthusiast
Posts: 63
Liked: 8 times
Joined: Jan 16, 2014 11:12 pm
Full Name: Jon Dufour
Contact:

Re: "File Copy" Job cmdlet

Post by PNWMtnBiker »

gcanales wrote:Hello,

A customer discovered the file copy jobs and asked me to create jobs to backup some local files in a few non-virtual servers and importants PCs. Almost 30 :shock:

Immediately thought in using Powershell to create those jobs, took a good look on the documentation, but I could find the cmdlet to create "file copy" jobs. Is there any? Please tell there is one.

Custo has B&R 7.0 R2 latest patch up to today installed.

Thanks
The file copy job is for copying files from one datastore to another. It won't touch a non-virtual anything.

If a similar task was given to me I would use robocopy to copy those files from the sources to a virtual file server and then that virtual server would be backed up by Veeam.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

The file copy job is for copying files from one datastore to another. It won't touch a non-virtual anything.
Actually, the situation is slightly different. With the file copy job, you can copy files from/to any server added to backup server console; no matter what platform the server is using: physical or virtual one. Thanks.
PNWMtnBiker
Enthusiast
Posts: 63
Liked: 8 times
Joined: Jan 16, 2014 11:12 pm
Full Name: Jon Dufour
Contact:

Re: "File Copy" Job cmdlet

Post by PNWMtnBiker »

v.Eremin wrote: Actually, the situation is slightly different. With the file copy job, you can copy files from/to any server added to backup server console; no matter what platform the server is using: physical or virtual one. Thanks.
Holy Cow you are right, I had honestly tried just about a month ago and found I could only copy files that were in a datastore. But double checking this now I see that I had to register the source machine and it installs the transport software and then I can access the file system.

Even though I was incorrect I'm glad I had commented because I learned something new now :D
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

Yes, in order to copy files between two servers all you need to do is to go to "Files" node, select required files, and copy them. Otherwise, this process can be automated by File Copy Job.

Glad to hear that I was able to provide the useful knowledge. :)
benc
Novice
Posts: 5
Liked: never
Joined: Mar 02, 2014 12:11 am
Full Name: Ben Castellucci
Contact:

Re: "File Copy" Job cmdlet

Post by benc »

Thanks everyone. All this sounds like what I have found so far. Problem is I am unsure of the actual syntax to do this in powershell. From the gui there is the option to choose the source server & file path, then the same choices for destination. In the cmdlet there are only equivalent parameters for destination. The source parameter (-Objects) is a list of vm names. Additionally if I list an existing copy job like this (created with gui) it's type is, 'File Copy' which is not documented in the cmdlet help nor in online documentation. If the destination parameters were something like, '-DestinationServer' instead of just, '-Server' then I would at least experiment and try, '-SourceServer' or something but I am a little stumped.

Has anyone actually been able to create one of these from powershell? If so I would be interested in the syntax used.

Thanks again!
Ben
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

Hi, Ben, it seems that both me and Vitaliy have confused file copy job with VM copy one and provided you with the commandlet that is responsible for VM copy job creation.

As to file copy job, I can't remember the required commandlet off the top of my head, but I will double check it tomorrow, once I'm in the office.

Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

As far as I can tell, in order to create File Copy Job you have to specify "Files" in -Type switch. However, I can't find a way to select "source" files to copy.

Thanks.
benc
Novice
Posts: 5
Liked: never
Joined: Mar 02, 2014 12:11 am
Full Name: Ben Castellucci
Contact:

Re: "File Copy" Job cmdlet

Post by benc »

Thank you for checking into that.

Seems maybe the cmdlet is incomplete.

I think I can get around it by just creating scheduled file copy jobs with the gui.

Thanks again!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

Are these jobs going to have something in common? "Source", "Target", "Schedule", etc.? Thanks.
benc
Novice
Posts: 5
Liked: never
Joined: Mar 02, 2014 12:11 am
Full Name: Ben Castellucci
Contact:

Re: "File Copy" Job cmdlet

Post by benc »

My goal was to do a powershell script as a scheduled task to veamzip a vm then do a one-off file copy job.

These would all have the same source & folder but obviously different files.

I can just create a scheduled file copy job with the gui that grabs all files in a particular folder then do the veamzip-ing such that they all [hopefully] complete before it runs.
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: "File Copy" Job cmdlet

Post by Vitaliy S. »

Well...in order to make sure that your backup jobs (can use them instead of VeeamZIP) are over before starting the off-site copy, I would recommend using post-backup job script option, that would be triggered once backup job is over.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

In this case, you can create one folder, say, "VeeamZIP VMs" and specify it as a source for the file copy job created via GUI. This folder will be used as a place to where given VMs are VeeamZIPped.

As to the scheduled script, its algorithm might be as following:

1) Input VM name. ($VMname = Read-Host 'What is VM name?')
2) VeeamZIP the given VM. (Start-VBRZip)
3) Execute the file copy job. (Start-VBRJob)

Thanks.
benc
Novice
Posts: 5
Liked: never
Joined: Mar 02, 2014 12:11 am
Full Name: Ben Castellucci
Contact:

Re: "File Copy" Job cmdlet

Post by benc »

That's a darn good point - it doesn't actually have to have a schedule and it can indeed be executed manually. For some reason that escaped me until you mentioned it. It's just creating it to begin with that needs to be done with the gui.

Which actually solves my issue nicely since I remembered after my last post the reason why I wanted to do a one-off was so I could delete the file from the source once the copy job was complete. VeamZip-CopyJob-Delete.

Ok, I think I am good now. Thank you all for your help!

I know it is low priority however maybe fixing this cmdlet could make it's way onto the todo list?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: "File Copy" Job cmdlet

Post by veremin »

Glad to hear my input was helpful. If your need any other assistance, just let us know.

As to the file copy job comnandlet, we've already tracked the issue, and will take a closer look at it.

Thanks.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 20 guests