Delete Job Via Powershell

PowerShell script exchange

Delete Job Via Powershell

Postby Ianm » Mon Dec 19, 2011 3:27 pm

I Veeam backup to a 3TB Drive then to Tape, every week I need to delete backup files and start again, leaving the job intact. So I regularly go into GUI and "Delete From Disk"

I started to look at Powershell to script it, but although I think it should be easy, I can't even get past GET-VBRJobObject !!!!

If I open Veeam Powershell and type GET-VBRJob I get a list of Jobs, If I then type GET-VBRJobOject it asks me for a Job, if I enter a job from the list I get errors

I have used some powershell in SQL but this doesn't make sense

Effectively I want to script two jobs and delete the files once a week from a scheduler
Ianm
Lurker
 
Posts: 2
Liked: never
Joined: Tue Dec 06, 2011 11:22 am
Full Name: Ian Mawson

Re: Delete Job Via Powershell

Postby ThomasMc » Mon Dec 19, 2011 4:12 pm

You'll want to do this for v6
Code: Select all
Get-VBRBackup -Name "Backup Name" | Remove-VBRBackup -FromDisk -WhatIf


just drop the -whatif to commit the action as right now it's only telling you what it would have done
ThomasMc
Veeam MVP
 
Posts: 286
Liked: 16 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Delete Job Via Powershell

Postby Ianm » Mon Dec 19, 2011 4:26 pm

But this asks a Yes / No question If I want to script it ???
Ianm
Lurker
 
Posts: 2
Liked: never
Joined: Tue Dec 06, 2011 11:22 am
Full Name: Ian Mawson

Re: Delete Job Via Powershell

Postby ThomasMc » Mon Dec 19, 2011 5:38 pm

like this

Code: Select all
Get-VBRBackup -Name "Backup Name" | Remove-VBRBackup -FromDisk -WhatIf -Confirm:$false


again dropping the -whatif if your certain
ThomasMc
Veeam MVP
 
Posts: 286
Liked: 16 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Delete Job Via Powershell

Postby Gostev » Mon Dec 19, 2011 8:48 pm

Ian, I guess Thomas just does not want to post a command that would immediately delete your backup from disk. If you are certain this is what you want to do, just remove the -WhatIf parameter from the original line. No questions will be asked in this case. Thanks!
Gostev
Veeam Software
 
Posts: 12912
Liked: 309 times
Joined: Sun Jan 01, 2006 1:01 am
Full Name: Anton Gostev


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest