powershell cmdlets

PowerShell script exchange

Re: powershell cmdlets

Veeam Logoby Alexey D. » Fri Feb 25, 2011 8:49 am

pavan.penmetsa wrote:Hello,
Can anyone let me know what we need to pass to the following commandlet as argument.

get-VSBTaskSession -session "?"


Hello Pavan,

Please try this:
Code: Select all
Get-VSBSession | {filter here} | Get-VSBTaskSession
Alexey D.
 

Powershell Veeam Set-VBRJobOptions

Veeam Logoby sidavid » Thu Sep 15, 2011 3:05 am

[merged]

Hi

I want to create a script to backup more than 100VMs. My Set-VBRJobOptions command is not working. Here is my script:

$job = $vbrjobname
Set-VBRJobOptions ($job) -EmailNotification $true
Set-VBRJobOptions ($job) -RetainCycles 2
Set-VBRJobOptions ($job) -CompressionLevel 4
$job.Save()

I have Veeam version 5

Thanks

ds
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby Vitaliy S. » Thu Sep 15, 2011 7:31 am

Please take a look at the first pages of this thread for some examples of this cmdlet, should help.
Vitaliy S.
Veeam Software
 
Posts: 19545
Liked: 1100 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: powershell cmdlets

Veeam Logoby Sethbartlett » Thu Sep 15, 2011 12:18 pm

You would need to do something like the following:

Code: Select all
$Job = Get-VBRJob | ?{$_.name -eq "JobName"}

Then you can do the Set-VBRJobOptions. You cannot simply give Get-VBRJob or JobOptions a string(Job Name), it requires an object and is more .NET appropriate.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: powershell cmdlets

Veeam Logoby sidavid » Thu Sep 15, 2011 3:22 pm

Hi
I tried this
$job = Get-VBRJob | ?{$_.name -eq "Lab"}
Set-VBRJobOptions ($job) -EmailNotification $true

And I receive the following error:

PS C:\Documents and Settings\Administrator\Desktop> .\test2.ps1
Set-VBRJobOptions : A parameter cannot be found that matches parameter name 'Em
ailNotification'.
At C:\Documents and Settings\Administrator\Desktop\test2.ps1:2 char:44
+ Set-VBRJobOptions ($job) -EmailNotification <<<< $true
+ CategoryInfo : InvalidArgument: (:) [Set-VBRJobOptions], Parame
terBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Veeam.Backup.PowerShell.C
ommand.SetVBRJobOptions

Thanks to all
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby sidavid » Sat Sep 24, 2011 8:55 pm

Hi
I still have the issue and I'm blocked with this error.
Thanks for your help
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby htwnrva » Fri Oct 07, 2011 5:20 pm

Hi I am having the same issues using 5.0.2 also. I get

PS Set-VBRJobOptions ($job) -EmailNotification $true
Set-VBRJobOptions : A parameter cannot be found that matches parameter name 'Em
ailNotification'.
At line:1 char:44
+ Set-VBRJobOptions ($job) -EmailNotification <<<< $true
+ CategoryInfo : InvalidArgument: (:) [Set-VBRJobOptions], Parame
terBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Veeam.Backup.PowerShell.C
ommand.SetVBRJobOptions

Any ideas?
htwnrva
Enthusiast
 
Posts: 30
Liked: never
Joined: Wed Jan 20, 2010 6:59 pm
Full Name: Ronny

Re: powershell cmdlets

Veeam Logoby ThomasMc » Tue Oct 11, 2011 11:12 am

Is this what you are looking for?

Code: Select all
$job = Get-VBRJob | ?{$_.name -eq "JobName"}
$vo = $job.GetOptions()
$vo.EmailNotification = $true
$job.SetOptions($vo)



Not sure why the $job.Save() doesn't work but it does update the job checkbox without it
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: powershell cmdlets

Veeam Logoby jteager » Tue Oct 11, 2011 2:50 pm

The $job.SetOptions($opt) command will implicitly save the job when run with a valid parameter, so .Save() is unnecessary in this circumstance.
jteager
Veeam Software
 
Posts: 10
Liked: never
Joined: Mon Mar 28, 2011 2:13 pm
Full Name: Justin Teager

Re: powershell cmdlets

Veeam Logoby ThomasMc » Tue Oct 11, 2011 3:21 pm

Ah right, thanks for that Justin.
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: powershell cmdlets

Veeam Logoby sidavid » Thu Nov 03, 2011 4:12 am

Hi,
How can I change the backup mode to Reversed Incremental? What is the property name?
Many Thanks
DS
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby Vitaliy S. » Thu Nov 03, 2011 8:10 am

Hello sidavid,

You can export existing job via Get-VBRJob | Export-VBRJob PowerShell command to review job configuration settings in XML file, should help to locate all the properties.

Hope this helps!
Vitaliy S.
Veeam Software
 
Posts: 19545
Liked: 1100 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: powershell cmdlets

Veeam Logoby sidavid » Thu Nov 03, 2011 11:52 am

Hi

This is exactly what I'm looking for.

Thanks
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby sidavid » Thu Nov 03, 2011 7:57 pm

Hi,

I have created a script that get all Vms in a directory, but I have a small issue, the virtual machines are not added to the job.

Add-PSSnapin "VeeamPSSnapIn"
Add-pssnapin VMware.VimAutomation.Core
Connect-VIServer 192.168.1.10
get-folder "Temp" | get-vm | foreach {$v = $_.name
$vbrserver = Get-VBRServer | Where {$_.Type -eq "Local"}
$vbrjobname = $v
$vbrfolder = "C:\BACK\" + $v
$vbrfile = $v + ".vbk"
$vbrobjects = $v
Add-VBRBackupJob -Name $vbrjobname -Type VDDK -Server $vbrserver -Folder $vbrfolder -FileName $vbrfile -Objects $vbrobjects
}

The job is created but Objects in job 0, I'm running vcenter 4.1

Thanks

DS
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell cmdlets

Veeam Logoby Vitaliy S. » Fri Nov 04, 2011 10:52 am

Hi, please look through this topic where there is an "add VM" example script: Remove-VBRJobObject (nevermind the title)
Vitaliy S.
Veeam Software
 
Posts: 19545
Liked: 1100 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

PreviousNext

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests