PowerShell script exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Andys scripting corner - Automatic job creation/filling

Post by Andreas Neufert » 1 person likes this post

#############################################################################################################
#
# Veeam
#
# Author: Andreas Neufert - Systems Engineer Central EMEA (Germany)
#
# March 2012
#
# Version 3.04
#
# ./AddVM-V3.ps1
#
# Description:
# Add VM to defined job and set VSS (V1)
#
# If the job not exist. (V2)
# - It creates the job (V2)
# - set a repository with the highest free space (V2)
# - set restore point amount (V2)
# - set VSS settings (Default and VM) (deselectable) (V2)
# - Enables Scheduler for Daily Backup (adjustable) (V2)
#
# If you set no jobname (V3)
# - It checks if the VM can be added to a suitable job (OS Type, Application Type, Production/Test Type) with a free slot.(V3)
# - If there is no suitable job (V3)
# - It searchs for a repository with the highest free space (V3)
# - Checks the highest job number in that repository (V3)
# - Creates a Job and set options incl. Scheduler and if neede VSS (V3)
#
#
#Error handling is included (V1, Enhanced in V2)
#
# !!!! This script doesn´t support ESX3.5 !!!!
#
################################################################################################################
# !!! This script is highly addapted for one of my customers. Several minimum requirements.
# !!! Because this script automates job building it makes only sense if you have more than 400 VMs
#
# Minimum Requirements:
#
# VM Names
# First letter: P => Productive Everything else => Test
# Second and Thrid letter: Application
# All other letters are freely definable
# Example PDB001
#
# Repositories:
# Only one repository per disk volume allowed
# Allowed Names:
# Example: REP001
# REP + sequence number


Code:

Code: Select all

#############################################################################################################
#                                                                                                           
# Veeam                                                                              
#                                                                                                           
# Author: Andreas Neufert - Systems Engineer Central EMEA (Germany)                                                                                   
#                                                                                                           
# March 2012
#
# Version 3.04                                                                                              
#                                                                                                           
# ./AddVM-V3.ps1
#
# Description:
# Add VM to defined job and set VSS (V1) 
#                                                                                                                                                                    
# If the job not exist. (V2)
# - It creates the job (V2)
# - set a repository with the highest free space (V2)
# - set restore point amount (V2)
# - set VSS settings (Default and VM) (deselectable) (V2)
# - Enables Scheduler for Daily Backup (adjustable) (V2)
#
# If you set no jobname (V3)
# - It checks if the VM can be added to a suitable job (OS Type, Application Type, Production/Test Type) with a free slot.(V3)
# - If there is no suitable job (V3)
#           - It searchs for a repository with the highest free space (V3)
#           - Checks the highest job number in that repository (V3)
#           - Creates a Job and set options incl. Scheduler and if neede VSS (V3)
#
#
#Error handling is included (V1, Enhanced in V2)   
#
# !!!! This script doesn´t support ESX3.5 !!!! 
#
################################################################################################################
# !!! This script is highly addapted for one of my customers. Several minimum requirements.
# !!! Because this script automates job building it makes only sense if you have more than 400 VMs
#
# Minimum Requirements:
#
# VM Names
# First letter: P => Productive  Everything else => Test
# Second and Thrid letter: Application
# All other letters are freely definable
# Example  PDB001
#
# Repositories:
# Only one repository per disk volume allowed
# Allowed Names:
# Example: REP001
# REP + sequence number
#
# 
#                                                                   
#
###################################################################

#############################################################################################################
#                                                                                                       
#############################################################################################################
#Manual Input (With input validation). This values can also be set by an extern Script. Be carefull with the Password field type that it will be a string type.
$VM = "pASV0816" # Rules see above
$VSSEnabled = "True" #True/False
$Username = "Administrator"
$Password = "Test"
$Domain = "demolab"
$CreateJobName = "" # Empty or for example rep001-005-auto-win2008_64-as-prod
$OSName = "Win2003_64" # Allowed values defined in AllowedOSNames bellow
############################################################################################################
# Editable Settings (be carefull => no input validation)

$VCenter = "vcenter.demolab.an.veeam.de" #vCenter/ESX-Host that was added to B&R Console - as displayed in the B&R Console

$RetainCyclesadd = "3" # Restore Points
$RetainDaysadd = "5" # VM deleted retention period in days


$VSSDefaultUsername = "Username"
$VSSDefaultPassword = "Password"
$VSSDefaultDomain = "Domain"
$SetResultsToVmNotesadd = "True" #Write Results to VM description/custom field
$VmAttributeNameadd = "BackupNotes" #Write Results to VM description/custom field

$MaxAmountOfVMsPerJob = "10" #1-999 but "100" not allowed. Recommended setting 10-15
$AllowedOSNames = "Win2003_64","Win2008_64","Linux"
$VMSignforProduction = "p" #VM Name first letter. Please define what is the letter for the productive VMs. All others are integrated into Test. 
$SelectJobAuto = "auto" #What value stands for Jobs that will be considered in our processing. If Job Name is defined not as auto this script will not add VM to these jobs.

#Scheduler
$EnableScheduler = "True" #True/False
$RetrySpecifiedAdd = "True" #True/False
$RetryTimesAdd = "2"
$RetryTimeoutAdd = "22"
$OptionsDailyAddKind = "SelectedDays" #Everyday/SelectedDays/WeekDays
$OptionsDailyAddDays = "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday"
$OptionsDailyAddTime = "22:10:00" 
#Attention: If you set a time earlier than now, the job will start at the next selected Weekday

############################################################################################################
# Hardcoded Settings (do not change => Other settings than these are not considered in the code)
$Algorithmadd = "Syntethic" #Syntethic means ReverseIncremental
$SourceProxyAutoDetectadd = "True" #Automatic Proxy Selection
$schedulemode = "Daily" #Daily/Monthly/Periodically/Continuous
$MaximumErrorCount = 1000
$VSSEnabledadd = "True" #True => Development switch


#############################################################################################################
# Start

# Empty lines to see every code in the powershellwindow (jump under Powershellprozessing bar)
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "
Write-host ". "

#Set Starttime
$StartTime = get-date -format u
write-host $StartTime "Information: Start time:" $StartTime



#Loads Veeam Powershell Snapin
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$ActualDate = get-date -format u
write-host $ActualDate "Information: Veeam Powershell plugin loaded"

#Reset Error Counter
$Resultcounter = 0
$error.clear()
$ActualDate = get-date -format u
write-host $ActualDate "Information: Error counter reseted"



#Check if jobname is empty
# =>IF 2<=
if  ($CreateJobName -eq "") {
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§


#Information
$ActualDate = get-date -format u
write-host $ActualDate "Information: Jobname empty... Searching for a job with an empty VM backup slot"


#Reset VM Error Counter
$VMResultcounter = 0
$ActualDate = get-date -format u
write-host $ActualDate "Information: VM counter reseted"

#Information
$ActualDate = get-date -format u
write-host $ActualDate "Information: Read out all Jobs and find the first empty job"

# Build a seach value for empty job search
$SelectJobOS = $OSName
$SelectJobAppType = $VM.Substring(1,2)
$SelectJobProdorTest = $VM.Substring(0,1)
If ($SelectJobProdorTest -eq $VMSignforProduction){
$SelectJobProdorTestResult = "prod"
} ELSE {
$SelectJobProdorTestResult = "test"
}
$SelectjobOutput = $SelectJobAuto + "-" + $SelectJobOS + "-" + $SelectJobAppType + "-" + $SelectJobProdorTestResult
$ActualDate = get-date -format u
write-host $ActualDate "Information: Job Search String is:" $SelectjobOutput


#Check if there is at minimum one job that fits the Search String.
$JobnameObjectVMCountObjects = Get-VBRJob | Where {$_.Name -match $SelectjobOutput}
# =>IF 1893<=
If ($JobnameObjectVMCountObjects -ne $Null){
$ActualDate = get-date -format u
write-host $ActualDate "Information: Found at minimum 1 job that fits the search string."


#Check if a job has a free slot for selected VM

foreach ($jobnameobjectVMCountObject in $JobnameObjectVMCountObjects) {
$jobnameobjectVMCountObjectOptions = $jobnameobjectVMCountObject.getoptions()

#If MaxAmountOfVMsPerJob is emty or or 100 set MaxAmountOfVMsPerJob
If ($jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb -eq $NULL){
$jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb = $MaxAmountOfVMsPerJob
$jobnameobjectVMCountObject.setoptions($jobnameobjectVMCountObjectOptions)
$ActualDate = get-date -format u
write-host $ActualDate "Information: Max amount of VMs per job not set for" $jobnameobjectVMCountObject.name "Set default setting: " $MaxAmountOfVMsPerJob
} ELSE { }
If ($jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb -eq "100"){
$jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb = $MaxAmountOfVMsPerJob
$jobnameobjectVMCountObject.setoptions($jobnameobjectVMCountObjectOptions)
$ActualDate = get-date -format u
write-host $ActualDate "Information: Max amount of VMs per job not set for" $jobnameobjectVMCountObject.name "Set default setting: " $MaxAmountOfVMsPerJob
} ELSE { }

#Read all VMs from the actual job
$VMsinJobObjects = Get-VBRJob -Name $jobnameobjectVMCountObject.Name
$VMsinJob = $VMsinJobObjects.GetObjectsInJob()

#Check if MaxAmountOfVMsPerJob as current VMs in the job
If ($jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb -gt $VMsinJob.Length) {
$ActualDate = get-date -format u
write-host $ActualDate "Information: Adding VM to" $jobnameobjectVMCountObject.name " - Max VM:" $jobnameobjectVMCountObjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb " - Number of VMs in Job:" $VMsinJob.Length

$CreateJobName = $jobnameobjectVMCountObject.name
$JobnameObject = $jobnameobjectVMCountObject

### Start of Part 1.1
### Start of Part 1.1
### Start of Part 1.1




$ActualDate = get-date -format u
Write-host $ActualDate "Information: Jobname is" $CreateJobName

#Check if VCenter/ESX exists
$vbrserverVC = Get-VBRServer | where {$_.Name -eq $VCenter}
# =>IF 93<=
if  ($vbrserverVC -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: vcenter/ESX name not correct. vcenter/ESX: " $VCenter
# =>IF 93<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: vcenter/ESX name accepted. vcenter/ESX: " $vcenter

#Check if VM exists
$vbrobjects = Find-VBRObject $vbrserverVC | ?{$_.name -eq $VM}
# =>IF 94<=
if  ($vbrobjects -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VM does not exist. VM Name: " $VM
# =>IF 94<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: VM exists. VM Name: " $VM

#Add VM to Job
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: Adding " $VM " to Job " $CreateJobName
Add-VBRJobObject -Job $JobnameObject -Server $vbrserverVC -Object $vbrobjects

#Check if VM was sucessfully added
$ActualDate = get-date -format u
write-host $ActualDate "Information: Start proofcheck"
$tt = Get-VBRJob -Name $JobnameObject | Get-VBRJobObject | where {$_.name -eq $VM}
$erg = $VM -notmatch $tt.Name
$ActualDate = get-date -format u
#write-host $ActualDate "Information: Proofcheck result:" $erg
# =>IF 95<=
IF ($erg -eq "True") {
$resultcounter++
$ActualDate = get-date -format u
write-host $ActualDate "Error: " $VM "not added to job " $CreateJobName
# =>IF 95<=
} ELSE  {
$ActualDate = get-date -format u
write-host $ActualDate "Information: Successfully added: " $VM

# =>IF 942<=
If ($VSSEnabled -eq "True") {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is enabled"

#Set VM VSS credentials
#Check if Domain Username and Passwort isn´t empty
# =>IF 96<=
if  ($Domain -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Domain not set"
# =>IF 96<=
} ELSE{
# =>IF 97<=
if  ($Username -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Username not set"
# =>IF 97<=
} ELSE{
# =>IF 98<=
if  ($Password -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Password not set"
# =>IF 98<=
} ELSE{
$cred1 = "$Domain\$Username"
$cred2 = "$Password"
$VMLoaded = Get-VBRJob -Name $CreateJobName | Get-VBRJobObject -Name $VM
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $cred1,$cred2,0,0
$VSSJobOptions = $VMLoaded.GetVssOptions()
$VSSJobOptions.Credentials = $Credentials
Set-VBRJobObjectVssOptions -object $VMLoaded -options $VSSJobOptions
Write-host $ActualDate "Information: VSS credentials set successfully"

# =>IF 98<=
}
# =>IF 97<=
}
# =>IF 96<=
}
# =>IF 942<=
} ELSE { 
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is disabled"
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"
# =>IF 942<=
}
# =>IF 95<=
}
# =>IF 94<=
}
# =>IF 93<=
}




### End of Part 1.1
### End of Part 1.1
### End of Part 1.1

# Set VMresultcounter +1
$VMresultcounter++
# Breack foreachloop
break
} ELSE {
$ActualDate = get-date -format u
write-host $ActualDate "Information: No empty slot in" $jobnameobjectVMCountObject.name
}
}

# =>IF 1893<=
} ELSE {
$VMresultcounter = "0"
# =>IF 1893<=
}

# =>IF 1221<=
If ($VMresultcounter -ne "0") {
#do nothing
# =>IF 1221<=
} ELSE {


$ActualDate = get-date -format u
write-host $ActualDate "Information: No job fits the search string or no empty job slot ... Creating new job."
$ActualDate = get-date -format u
write-host $ActualDate "Information: Start creating new job"

### Start of Part 1.2
### Start of Part 1.2
### Start of Part 1.2

# =>IF 1222<=
If ($AllowedOSNames -contains $OSName) {
$ActualDate = get-date -format u
write-host $ActualDate "Information: OSName " $OSName "accepted"
# =>IF 1222<=
} ELSE {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: OSName not allowed"
# =>IF 1222<=
}


# OS-Typ prüfen ob erlaubt.
# Wenn ja
# Suche Repository mit dem meisten Platz
# Wähle die höchste Nummer und erstelle einen Job mit noch höherer Nummer.

#Search for the Repository with the highest free space.
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Search for the Repository with the highest free space"
$Repository1 = Get-VBRBackupRepository
$b = "0"
foreach ($RepositoryNames in $Repository1) {
$r = Get-VBRBackupRepository -name $RepositoryNames.name
$rServer = $r.GetHost()
$FileCommander = [Veeam.Backup.Core.CRemoteWinFileCommander]::Create($rServer.Info)
$storage = $FileCommander.GetDrives([ref]$null) | ?{$_.Name -eq $r.Path.Substring(0,3)}
$outputObj = [Math]::Round([Decimal]$storage.FreeSpace/1GB,0)
$ia = $RepositoryNames.name
If ($ia -eq "Default Backup Repository") {
$outputObj = 0
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Repository:" $ia "manually set to 0GB free space (disabled)"
} ELSE {}
$ib = $outputObj
$ActualDate = get-date -format u
write-host $ActualDate "Information: Repository: " $ia " with "$ib "GB free space"

if ($ib -ge $b) {
$b = $ib
$a = $ia
} ELSE {
}
}
$ActualDate = get-date -format u
write-host $ActualDate "Information: Selected Repository:" $a " with " $b "GB free space"

#Identify the highest Job Number from the repository +1
$b1 = "0"
$JobsOfRepositorys = Get-VBRJob | Where {$_.Name -match $a}
foreach ($JobsOfRepository in $JobsOfRepositorys){
$c1 = $JobsOfRepository.Name.Substring(7,3)
If ($c1 -ge $b1){
$b1 = $c1
} ELSE {
#nothing
}

# close foreach
}
$ActualDate = get-date -format u
write-host $ActualDate "Information: Highest Jobnumer in Repository" $a "is: "$b1


#Build new Jobname
$b2 = ([Decimal]$b1/[Decimal]"1000")+([Decimal]"1"/[Decimal]"1000")
[String]$b3 = $b2
$CreateJobName = $a + "-" + $b3.Substring(2,3) + "-" + $SelectjobOutput

#Check if VCenter/ESX exists
$vbrserverVC = Get-VBRServer | where {$_.Name -eq $VCenter}
# =>IF 889<=
if  ($vbrserverVC -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: vcenter/ESX name not correct. vcenter/ESX: " $VCenter
# =>IF 889<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: vcenter/ESX name accepted. vcenter/ESX: " $VCenter

#Check if VM exists
$vbrobjects = Find-VBRObject $vbrserverVC | ?{$_.name -eq $VM}
# =>IF 8810<=
if  ($vbrobjects -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VM does not exist. VM Name: " $VM
# =>IF 8810<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: VM exists. VM Name: " $VM


#Create job

$ActualDate = get-date -format u
Write-host $ActualDate  "Information: Create job " $CreateJobName " please wait..."

$CreateJobRep = Get-VBRBackupRepository -Name $a
$CreateJobVM = Find-VBRViEntity -Server $vbrserverVC -Name $VM
Add-VBRViBackupJob -Name $CreateJobName -BackupRepository $CreateJobRep -Entity $CreateJobVM

#Check if job name exists
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
# =>IF 8811<=
if  ($JobnameObject -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: Job was not created. Jobname: " $CreateJobName 
# =>IF 8811<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job" $CreateJobName "succesfully created." 


#Set Job Options
$JobnameObjectOptions = $JobnameObject.GetOptions()
$JobnameObjectOptions.BackupStorageOptions.RetainCycles = $RetainCyclesadd
$JobnameObjectOptions.JobOptions.SourceProxyAutoDetect = $SourceProxyAutoDetectadd
$JobnameObjectOptions.BackupStorageOptions.RetainDays = $RetainDaysadd
$JobnameObjectOptions.ViSourceOptions.SetResultsToVmNotes = $SetResultsToVmNotesadd
$JobnameObjectOptions.ViSourceOptions.VmAttributeName = $VmAttributeNameadd
$JobnameObjectOptions.BackupTargetOptions.Algorithm = $Algorithmadd
$jobnameobjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb = $MaxAmountOfVMsPerJob
$JobnameObject.setoptions($JobnameObjectOptions)
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job options set"



# Set Scheduling Options
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
$JobnameObjectSchedule = $JobnameObject | Get-VBRjobscheduleoptions
If ($RetrySpecifiedAdd -eq "True"){
$JobnameObjectSchedule.RetrySpecified = $true
} ELSE {
$JobnameObjectSchedule.RetrySpecified = $false
}
$JobnameObjectSchedule.RetryTimes = $RetryTimesAdd  
$JobnameObjectSchedule.RetryTimeout = $RetryTimeoutAdd
If ($schedulemode -eq "Daily"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $true
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Monthly"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $true
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Periodically"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $true
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Continuous"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $true
} ELSE {
$ActualDate = get-date -format u
write-host $ActualDate "Error: Schedulemode entry not correct"
}}}}

$JobnameObjectSchedule.OptionsDaily.Kind = $OptionsDailyAddKind
$JobnameObjectSchedule.OptionsDaily.Days = $OptionsDailyAddDays
$JobnameObjectSchedule.OptionsDaily.Time = $OptionsDailyAddTime
$JobnameObjectSchedule.NextRun = $OptionsDailyAddTime
$JobnameObjectSchedule.StartDateTime = $OptionsDailyAddTime
Set-VBRJobScheduleOptions -Job $JobnameObject -Options $JobnameObjectSchedule


#$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
If ($EnableScheduler -eq "True"){
$JobnameObject.options.JobOptions.RunManually = $false
$JobnameObject.EnableScheduler()
} ELSE {
$JobnameObject.options.JobOptions.RunManually = $true
$JobnameObject.DisableScheduler()
}

$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job scheduling options set"


# =>IF 8841<=
If ($VSSEnabled -eq "True") {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is enabled"

#Set VSS Default credentials
$jobnameobject = Get-VBRJob -Name $CreateJobName
$jobnameobjectVSS = $jobnameobject | Get-VBRJobVSSOptions
$credVSSDefault1 = "$VSSDefaultDomain\$VSSDefaultUsername"
$credVSSDefault2 = "$VSSDefaultPassword"
$CredentialsVSSDefault = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $credVSSDefault1,$credVSSDefault2,0,0
$jobnameobjectVSS.Credentials = $CredentialsVSSDefault
$jobnameobject | Set-VBRJobVssOptions -Options $jobnameobjectVSS
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS Default Options set"

#Enable VSS
$JobnameObjectOptionsVSS = $JobnameObject.GetVSSOptions()
$JobnameObjectOptionsVSS.Enabled = $VSSEnabledadd
$JobnameObject.setVSSoptions($JobnameObjectOptionsVSS)
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS Enabled"

#Set VM VSS credentials
#Check if Domain Username and Passwort isn´t empty
# =>IF 8831<=
if  ($Domain -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Domain not set"
# =>IF 8831<=
} ELSE{
# =>IF 8832<=
if  ($Username -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Username not set"
# =>IF 8832<=
} ELSE{
# =>IF 8833<=
if  ($Password -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Password not set"
# =>IF 8833<=
} ELSE{

#Set VSS VM credentials
$VMLoaded = Get-VBRJob -Name $CreateJobName | Get-VBRJobObject -Name $VM
$cred1 = "$Domain\$Username"
$cred2 = "$Password"
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $cred1,$cred2,0,0
$VSSJobOptions = $JobnameObject.GetVssOptions()
$VSSJobOptions.Credentials = $Credentials
Set-VBRJobObjectVssOptions -object $VMLoaded -options $VSSJobOptions

$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS VM credentials set"


$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"

# =>IF 8833<=
}
# =>IF 8832<=
}
# =>IF 8831<=
}

# =>IF 8841<=
} ELSE { 
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is disabled"
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"
# =>IF 8841<=
}


# =>IF 8811<=
}







# =>IF 8810<=
}

# =>IF 889<=
}




# =>IF 1221<=
}

# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 1 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

# =>IF 2<=
} ELSE {
Write-host $ActualDate "Information: Jobname not empty."

# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

#Check if jobname exists
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
# =>IF 1<=
if  ($JobnameObject -eq $Null)  {

$ActualDate = get-date -format u
Write-host $ActualDate "Information: Jobname does not exist. Jobname: " $CreateJobName
Write-host $ActualDate "Information: Starting job creation for: " $CreateJobName


#Search for the Repository with the highest free space.
#$ActualDate = get-date -format u
#Write-host $ActualDate "Information: Search for the Repository with the highest free space"
#$Repository1 = Get-VBRBackupRepository
#$b = "0"
#foreach ($RepositoryNames in $Repository1) {
#$r = Get-VBRBackupRepository -name $RepositoryNames.name
#$rServer = $r.GetHost()
#$FileCommander = [Veeam.Backup.Core.CRemoteWinFileCommander]::Create($rServer.Info)
#$storage = $FileCommander.GetDrives([ref]$null) | ?{$_.Name -eq $r.Path.Substring(0,3)}
#$outputObj = [Math]::Round([Decimal]$storage.FreeSpace/1GB,0)
#$ia = $RepositoryNames.name
#If ($ia -eq "Default Backup Repository") {
#$outputObj = 0
#$ActualDate = get-date -format u
#Write-host $ActualDate "Information: Repository:" $ia "manually set to 0GB free space (disabled)"
#} ELSE {}
#$ib = $outputObj
#$ActualDate = get-date -format u
#write-host $ActualDate "Information: Repository: " $ia " with "$ib "GB free space"
#
#if ($ib -ge $b) {
#$b = $ib
#$a = $ia
#} ELSE {
#}
#}
$a = $CreateJobName.substring(0,6)
$ActualDate = get-date -format u
write-host $ActualDate "Information: Used Repository:" $a 

#Check if VCenter/ESX exists
$vbrserverVC = Get-VBRServer | where {$_.Name -eq $VCenter}
# =>IF 9<=
if  ($vbrserverVC -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: vcenter/ESX name not correct. vcenter/ESX: " $VCenter
# =>IF 9<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: vcenter/ESX name accepted. vcenter/ESX: " $VCenter

#Check if VM exists
$vbrobjects = Find-VBRObject $vbrserverVC | ?{$_.name -eq $VM}
# =>IF 10<=
if  ($vbrobjects -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VM does not exist. VM Name: " $VM
# =>IF 10<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: VM exists. VM Name: " $VM

#Create job

$ActualDate = get-date -format u
Write-host $ActualDate  "Information: Create job " $CreateJobName " please wait..."

$CreateJobRep = Get-VBRBackupRepository -Name $a
$CreateJobVM = Find-VBRViEntity -Server $vbrserverVC -Name $VM
Add-VBRViBackupJob -Name $CreateJobName -BackupRepository $CreateJobRep -Entity $CreateJobVM

#Check if job name exists
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
# =>IF 11<=
if  ($JobnameObject -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: Job was not created. Jobname: " $CreateJobName 
# =>IF 11<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job" $CreateJobName "succesfully created." 


#Set Job Options
$JobnameObjectOptions = $JobnameObject.GetOptions()
$JobnameObjectOptions.BackupStorageOptions.RetainCycles = $RetainCyclesadd
$JobnameObjectOptions.JobOptions.SourceProxyAutoDetect = $SourceProxyAutoDetectadd
$JobnameObjectOptions.BackupStorageOptions.RetainDays = $RetainDaysadd
$JobnameObjectOptions.ViSourceOptions.SetResultsToVmNotes = $SetResultsToVmNotesadd
$JobnameObjectOptions.ViSourceOptions.VmAttributeName = $VmAttributeNameadd
$JobnameObjectOptions.BackupTargetOptions.Algorithm = $Algorithmadd
$jobnameobjectOptions.ViSourceOptions.DoubleSnapshotThresholdMb = $MaxAmountOfVMsPerJob
$JobnameObject.setoptions($JobnameObjectOptions)
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job options set"



# Set Scheduling Options
$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
$JobnameObjectSchedule = $JobnameObject | Get-VBRjobscheduleoptions
If ($RetrySpecifiedAdd -eq "True"){
$JobnameObjectSchedule.RetrySpecified = $true
} ELSE {
$JobnameObjectSchedule.RetrySpecified = $false
}
$JobnameObjectSchedule.RetryTimes = $RetryTimesAdd  
$JobnameObjectSchedule.RetryTimeout = $RetryTimeoutAdd
If ($schedulemode -eq "Daily"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $true
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Monthly"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $true
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Periodically"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $true
$JobnameObjectSchedule.OptionsContinuous.Enabled = $false
} ELSE {
If ($schedulemode -eq "Continuous"){
$JobnameObjectSchedule.OptionsDaily.Enabled = $false
$JobnameObjectSchedule.OptionsMonthly.Enabled = $false
$JobnameObjectSchedule.OptionsPeriodically.Enabled = $false
$JobnameObjectSchedule.OptionsContinuous.Enabled = $true
} ELSE {
$ActualDate = get-date -format u
write-host $ActualDate "Error: Schedulemode entry not correct"
}}}}

$JobnameObjectSchedule.OptionsDaily.Kind = $OptionsDailyAddKind
$JobnameObjectSchedule.OptionsDaily.Days = $OptionsDailyAddDays
$JobnameObjectSchedule.OptionsDaily.Time = $OptionsDailyAddTime
$JobnameObjectSchedule.NextRun = $OptionsDailyAddTime
$JobnameObjectSchedule.StartDateTime = $OptionsDailyAddTime
Set-VBRJobScheduleOptions -Job $JobnameObject -Options $JobnameObjectSchedule


#$JobnameObject = Get-VBRJob | Where {$_.Name -eq $CreateJobName}
If ($EnableScheduler -eq "True"){
$JobnameObject.options.JobOptions.RunManually = $false
$JobnameObject.EnableScheduler()
} ELSE {
$JobnameObject.options.JobOptions.RunManually = $true
$JobnameObject.DisableScheduler()
}

$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job scheduling options set"


# =>IF 41<=
If ($VSSEnabled -eq "True") {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is enabled"

#Set VSS Default credentials
$jobnameobject = Get-VBRJob -Name $CreateJobName
$jobnameobjectVSS = $jobnameobject | Get-VBRJobVSSOptions
$credVSSDefault1 = "$VSSDefaultDomain\$VSSDefaultUsername"
$credVSSDefault2 = "$VSSDefaultPassword"
$CredentialsVSSDefault = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $credVSSDefault1,$credVSSDefault2,0,0
$jobnameobjectVSS.Credentials = $CredentialsVSSDefault
$jobnameobject | Set-VBRJobVssOptions -Options $jobnameobjectVSS
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS Default Options set"

#Enable VSS
$JobnameObjectOptionsVSS = $JobnameObject.GetVSSOptions()
$JobnameObjectOptionsVSS.Enabled = $VSSEnabledadd
$JobnameObject.setVSSoptions($JobnameObjectOptionsVSS)
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS Enabled"

#Set VM VSS credentials
#Check if Domain Username and Passwort isn´t empty
# =>IF 31<=
if  ($Domain -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Domain not set"
# =>IF 31<=
} ELSE{
# =>IF 32<=
if  ($Username -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Username not set"
# =>IF 32<=
} ELSE{
# =>IF 33<=
if  ($Password -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Password not set"
# =>IF 33<=
} ELSE{

#Set VSS VM credentials
$VMLoaded = Get-VBRJob -Name $CreateJobName | Get-VBRJobObject -Name $VM
$cred1 = "$Domain\$Username"
$cred2 = "$Password"
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $cred1,$cred2,0,0
$VSSJobOptions = $JobnameObject.GetVssOptions()
$VSSJobOptions.Credentials = $Credentials
Set-VBRJobObjectVssOptions -object $VMLoaded -options $VSSJobOptions

$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS VM credentials set"


$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"

# =>IF 33<=
}
# =>IF 32<=
}
# =>IF 31<=
}

# =>IF 41<=
} ELSE { 
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is disabled"
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"
# =>IF 41<=
}


# =>IF 11<=
}
# =>IF 10<=
}
# =>IF 9<=
}


# =>IF 1<=
} Else {
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 2 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§


# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Start of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

$ActualDate = get-date -format u
Write-host $ActualDate "Information: Jobname is" $CreateJobName

#Check if job name exists
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Jobname name accepted. Jobname: " $CreateJobName

#Check if VCenter/ESX exists
$vbrserverVC = Get-VBRServer | where {$_.Name -eq $VCenter}
# =>IF 3<=
if  ($vbrserverVC -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: vcenter/ESX name not correct. vcenter/ESX: " $VCenter
# =>IF 3<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: vcenter/ESX name accepted. vcenter/ESX: " $vcenter

#Check if VM exists
$vbrobjects = Find-VBRObject $vbrserverVC | ?{$_.name -eq $VM}
# =>IF 4<=
if  ($vbrobjects -eq $Null)  {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VM does not exist. VM Name: " $VM
# =>IF 4<=
} Else {
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: VM exists. VM Name: " $VM

#Add VM to Job
$ActualDate = get-date -format u
Write-host $ActualDate  "Information: Adding " $VM " to Job " $CreateJobName
Add-VBRJobObject -Job $JobnameObject -Server $vbrserverVC -Object $vbrobjects

#Check if VM was sucessfully added
$ActualDate = get-date -format u
write-host $ActualDate "Information: Start proofcheck"
$tt = Get-VBRJob -Name $JobnameObject | Get-VBRJobObject | where {$_.name -eq $VM}
$erg = $VM -notmatch $tt.Name
$ActualDate = get-date -format u
#write-host $ActualDate "Information: Proofcheck result:" $erg
# =>IF 5<=
IF ($erg -eq "True") {
$resultcounter++
$ActualDate = get-date -format u
write-host $ActualDate "Error: " $VM "not added to job " $CreateJobName
# =>IF 5<=
} ELSE  {
$ActualDate = get-date -format u
write-host $ActualDate "Information: Successfully added: " $VM

# =>IF 42<=
If ($VSSEnabled -eq "True") {
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is enabled"

#Set VM VSS credentials
#Check if Domain Username and Passwort isn´t empty
# =>IF 6<=
if  ($Domain -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Domain not set"
# =>IF 6<=
} ELSE{
# =>IF 7<=
if  ($Username -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Username not set"
# =>IF 7<=
} ELSE{
# =>IF 8<=
if  ($Password -eq "") {
$resultcounter++
$ActualDate = get-date -format u
Write-host $ActualDate "Error: VSS Password not set"
# =>IF 8<=
} ELSE{
$cred1 = "$Domain\$Username"
$cred2 = "$Password"
$VMLoaded = Get-VBRJob -Name $CreateJobName | Get-VBRJobObject -Name $VM
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList $cred1,$cred2,0,0
$VSSJobOptions = $VMLoaded.GetVssOptions()
$VSSJobOptions.Credentials = $Credentials
Set-VBRJobObjectVssOptions -object $VMLoaded -options $VSSJobOptions
Write-host $ActualDate "Information: VSS credentials set successfully"

# =>IF 8<=
}
# =>IF 7<=
}
# =>IF 6<=
}
# =>IF 42<=
} ELSE { 
$ActualDate = get-date -format u
Write-host $ActualDate "Information: VSS is disabled"
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Finished with job options"
# =>IF 42<=
}
# =>IF 5<=
}
# =>IF 4<=
}
# =>IF 3<=
}

# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ End of Part 3 §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§





# =>IF 1<=
}
# =>IF 2<=
}





# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Results §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Results §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
# §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Results §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

$Resultcounterend = $Resultcounter + $error.count

#Results
IF ($Resultcounterend -lt 1)
{
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job started at " $StartTime
Write-host $ActualDate "Information: Job finished at " $ActualDate
Write-host $ActualDate "Information: VM: " $VM
Write-host $ActualDate "Information: Jobname: " $CreateJobName
write-host $ActualDate "Information: Job Finished successfully"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
}
ELSE
{
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
$ActualDate = get-date -format u
Write-host $ActualDate "Information: Job started at " $StartTime
Write-host $ActualDate "Information: Job finished at " $ActualDate
Write-host $ActualDate "Information: ERROR ERROR ERROR ERROR ERROR ERROR ERROR"
Write-host $ActualDate "Error: There are " $Resultcounterend "Errors"
Write-host $ActualDate "Error: Job Finished with Errors"
Write-host "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"    
}

#End

Andreas Neufert
VP, Product Management
Posts: 7081
Liked: 1511 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Andys scripting corner - Automatic job creation/filling

Post by Andreas Neufert »

Output Example: VM and Job definied but job not exist

Code: Select all


PS E:\scripts> E:\scripts\AddVM-V3.ps1
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
2012-04-19 00:07:34Z Information: Start time: 2012-04-19 00:07:34Z
2012-04-19 00:07:34Z Information: Veeam Powershell plugin loaded
2012-04-19 00:07:34Z Information: Error counter reseted
2012-04-19 00:07:34Z Information: Jobname not empty.
2012-04-19 00:07:39Z Information: Jobname does not exist. Jobname:  rep001-007-auto-win2008_64-as-prod
2012-04-19 00:07:39Z Information: Starting job creation for:  rep001-007-auto-win2008_64-as-prod
2012-04-19 00:07:39Z Information: Used Repository: rep001
2012-04-19 00:07:43Z Information: vcenter/ESX name accepted. vcenter/ESX:  vcenter.demolab.an.veeam.de
2012-04-19 00:07:52Z Information: VM exists. VM Name:  pASV0816
2012-04-19 00:07:52Z Information: Create job  rep001-007-auto-win2008_64-as-prod  please wait...


Id                     : 3876de08-8b6a-4fde-b424-4dc20511ac5b
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:08:01.
Name                   : rep001-007-auto-win2008_64-as-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-007-auto-win2008_64-as-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage
                         >True</IsFirstUsage><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions
                         >
ScheduleOptions        : Start time: [19.04.2012 00:13:05], Latest run time: [19.04.2012 00:08:05], Next run time: [], Retry times on failure: [3], Retry timeout: [10 min], Daily options: [Enabled: True, DayNumberIn
                         Month: Everyday, Days: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: S
                         aturday, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <s
                         cheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
                         0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:08:10Z Information: Job rep001-007-auto-win2008_64-as-prod succesfully created.
2012-04-19 00:08:10Z Information: Job options set
Id                     : 3876de08-8b6a-4fde-b424-4dc20511ac5b
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:08:01.
Name                   : rep001-007-auto-win2008_64-as-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-007-auto-win2008_64-as-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage
                         >True</IsFirstUsage><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions
                         >
ScheduleOptions        : Start time: [19.04.2012 22:10:00], Latest run time: [19.04.2012 00:08:05], Next run time: [22:10:00], Retry times on failure: [2], Retry timeout: [22 min], Daily options: [Enabled: True, Day
                         NumberInMonth: SelectedDays, Days: Monday, Tuesday, Wednesday, Thursday, Friday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: Saturda
                         y, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <schedul
                         er><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</T
                         uesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:08:22Z Information: Job scheduling options set
2012-04-19 00:08:22Z Information: VSS is enabled
Id                     : 3876de08-8b6a-4fde-b424-4dc20511ac5b
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:08:01.
Name                   : rep001-007-auto-win2008_64-as-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-007-auto-win2008_64-as-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>Domain\Username</UserName><Password>AQAAANCMnd8BFd
                         ERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAADfLXW6V+pley/zZtRcRT1UAAAAAASAAACgAAAAEAAAAMBPjZoCqzKsz3aIN0EbtAoQAAAAFhMBlIBNFAZC602g99RTSxQAAACIor150i1Jb/FBFwwBw4SMCETL
                         mg==</Password><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsag
                         e><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ScheduleOptions        : Start time: [19.04.2012 22:10:00], Latest run time: [19.04.2012 00:08:05], Next run time: [22:10:00], Retry times on failure: [2], Retry timeout: [22 min], Daily options: [Enabled: True, Day
                         NumberInMonth: SelectedDays, Days: Monday, Tuesday, Wednesday, Thursday, Friday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: Saturda
                         y, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <schedul
                         er><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</T
                         uesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:08:34Z Information: VSS Default Options set
2012-04-19 00:08:34Z Information: VSS Enabled
Id                  : ff479c51-fe13-4cb2-bbf8-a2425562c5f1
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 3876de08-8b6a-4fde-b424-4dc20511ac5b
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAAL3l02kGgaVF/ailAnUel9AAAAAASAAACgAAAAEAAAAF7qoQBzGUYhJDeNuuYe1tAIAAAAJYt7magLEGsUAAAAkz9buZfkh/4cr27eNIhjrwjG7E8=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:08:47Z Information: VSS VM credentials set
2012-04-19 00:08:47Z Information: Finished with job options
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2012-04-19 00:08:47Z Information: Job started at  2012-04-19 00:07:34Z
2012-04-19 00:08:47Z Information: Job finished at  2012-04-19 00:08:47Z
2012-04-19 00:08:47Z Information: VM:  pASV0816
2012-04-19 00:08:47Z Information: Jobname:  rep001-007-auto-win2008_64-as-prod
2012-04-19 00:08:47Z Information: Job Finished successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Output example: VM and Job definied and job exists

Code: Select all

PS E:\scripts> E:\scripts\AddVM-V3.ps1
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
2012-04-19 00:09:39Z Information: Start time: 2012-04-19 00:09:39Z
2012-04-19 00:09:39Z Information: Veeam Powershell plugin loaded
2012-04-19 00:09:39Z Information: Error counter reseted
2012-04-19 00:09:39Z Information: Jobname not empty.
2012-04-19 00:09:44Z Information: Jobname is rep001-007-auto-win2008_64-as-prod
2012-04-19 00:09:44Z Information: Jobname name accepted. Jobname:  rep001-007-auto-win2008_64-as-prod
2012-04-19 00:09:48Z Information: vcenter/ESX name accepted. vcenter/ESX:  vcenter.demolab.an.veeam.de
2012-04-19 00:09:57Z Information: VM exists. VM Name:  pASV0816
2012-04-19 00:09:58Z Information: Adding  pASV0816  to Job  rep001-007-auto-win2008_64-as-prod


Id                  : ff479c51-fe13-4cb2-bbf8-a2425562c5f1
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 3876de08-8b6a-4fde-b424-4dc20511ac5b
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAAL3l02kGgaVF/ailAnUel9AAAAAASAAACgAAAAEAAAAF7qoQBzGUYhJDeNuuYe1tAIAAAAJYt7magLEGsUAAAAkz9buZfkh/4cr27eNIhjrwjG7E8=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:10:03Z Information: Start proofcheck
2012-04-19 00:10:11Z Information: Successfully added:  pASV0816
2012-04-19 00:10:11Z Information: VSS is enabled
Id                  : ff479c51-fe13-4cb2-bbf8-a2425562c5f1
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 3876de08-8b6a-4fde-b424-4dc20511ac5b
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAAASNFnNt8RsV66i3qL95G5AAAAAASAAACgAAAAEAAAAG2EqUEHrEiTt/pk4S9WiVsIAAAA+gCWgl3qK60UAAAAI6Ku/Mw2fZXMC+fxKOgNpZ+nodI=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:10:11Z Information: VSS credentials set successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2012-04-19 00:10:23Z Information: Job started at  2012-04-19 00:09:39Z
2012-04-19 00:10:23Z Information: Job finished at  2012-04-19 00:10:23Z
2012-04-19 00:10:23Z Information: VM:  pASV0816
2012-04-19 00:10:23Z Information: Jobname:  rep001-007-auto-win2008_64-as-prod
2012-04-19 00:10:23Z Information: Job Finished successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Output example: Job not definied. Free slot in a existing Job.

Code: Select all

PS E:\scripts> E:\scripts\AddVM-V3.ps1
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
2012-04-19 00:13:04Z Information: Start time: 2012-04-19 00:13:04Z
2012-04-19 00:13:04Z Information: Veeam Powershell plugin loaded
2012-04-19 00:13:04Z Information: Error counter reseted
2012-04-19 00:13:04Z Information: Jobname empty... Searching for a job with an empty VM backup slot
2012-04-19 00:13:04Z Information: VM counter reseted
2012-04-19 00:13:04Z Information: Read out all Jobs and find the first empty job
2012-04-19 00:13:04Z Information: Job Search String is: auto-Win2003_64-AS-prod
2012-04-19 00:13:09Z Information: Found at minimum 1 job that fits the search string.
2012-04-19 00:13:13Z Information: No empty slot in rep001-001-auto-win2003_64-as-prod
2012-04-19 00:13:17Z Information: Adding VM to rep001-006-auto-Win2003_64-AS-prod  - Max VM: 33  - Number of VMs in Job: 1
2012-04-19 00:13:17Z Information: Jobname is rep001-006-auto-Win2003_64-AS-prod
2012-04-19 00:13:22Z Information: vcenter/ESX name accepted. vcenter/ESX:  vcenter.demolab.an.veeam.de
2012-04-19 00:13:31Z Information: VM exists. VM Name:  pASV0816
2012-04-19 00:13:31Z Information: Adding  pASV0816  to Job  rep001-006-auto-Win2003_64-AS-prod


Id                  : 42c5cfbc-906c-409b-b138-6846746407b5
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 38cb655d-63e0-4005-a0c8-532a5a727010
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAADLp7YfTO70cb3NBJSLKdkUAAAAAASAAACgAAAAEAAAAOuS0ahQ0eMGy87ZDxO1+RYIAAAAGD0LQ36XhLMUAAAA7jWa9QV/6Ej8+ov2pAGCIrV1++M=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:13:36Z Information: Start proofcheck
2012-04-19 00:13:44Z Information: Successfully added:  pASV0816
2012-04-19 00:13:44Z Information: VSS is enabled
Id                  : 42c5cfbc-906c-409b-b138-6846746407b5
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 38cb655d-63e0-4005-a0c8-532a5a727010
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAA8muc/bScQjItDjHLb7eLEAAAAAASAAACgAAAAEAAAAMtloX9MRqiJtCh4+Nb+6zIIAAAAokeWN/rVmxoUAAAAoCDW3vyKrIfMszh9RvcTtY7OaQo=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:13:44Z Information: VSS credentials set successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2012-04-19 00:13:56Z Information: Job started at  2012-04-19 00:13:04Z
2012-04-19 00:13:56Z Information: Job finished at  2012-04-19 00:13:56Z
2012-04-19 00:13:56Z Information: VM:  pASV0816
2012-04-19 00:13:56Z Information: Jobname:  rep001-006-auto-Win2003_64-AS-prod
2012-04-19 00:13:56Z Information: Job Finished successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



Output example: Job not defined and no free Job slot

Code: Select all

PS E:\scripts> E:\scripts\AddVM-V3.ps1
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
2012-04-19 00:14:59Z Information: Start time: 2012-04-19 00:14:59Z
2012-04-19 00:14:59Z Information: Veeam Powershell plugin loaded
2012-04-19 00:14:59Z Information: Error counter reseted
2012-04-19 00:14:59Z Information: Jobname empty... Searching for a job with an empty VM backup slot
2012-04-19 00:14:59Z Information: VM counter reseted
2012-04-19 00:14:59Z Information: Read out all Jobs and find the first empty job
2012-04-19 00:14:59Z Information: Job Search String is: auto-Win2003_64-AS-prod
2012-04-19 00:15:04Z Information: Found at minimum 1 job that fits the search string.
2012-04-19 00:15:08Z Information: No empty slot in rep001-001-auto-win2003_64-as-prod
2012-04-19 00:15:12Z Information: No empty slot in rep001-002-auto-win2003_64-aS-prod
2012-04-19 00:15:12Z Information: No job fits the search string or no empty job slot ... Creating new job.
2012-04-19 00:15:12Z Information: Start creating new job
2012-04-19 00:15:12Z Information: OSName  Win2003_64 accepted
2012-04-19 00:15:12Z Information: Search for the Repository with the highest free space
2012-04-19 00:15:21Z Information: Repository:  rep001  with  69 GB free space
2012-04-19 00:15:26Z Information: Repository: Default Backup Repository manually set to 0GB free space (disabled)
2012-04-19 00:15:26Z Information: Repository:  Default Backup Repository  with  0 GB free space
2012-04-19 00:15:26Z Information: Selected Repository: rep001  with  69 GB free space
2012-04-19 00:15:31Z Information: Highest Jobnumer in Repository rep001 is:  004
2012-04-19 00:15:35Z Information: vcenter/ESX name accepted. vcenter/ESX:  vcenter.demolab.an.veeam.de
2012-04-19 00:15:44Z Information: VM exists. VM Name:  pASV0816
2012-04-19 00:15:44Z Information: Create job  rep001-005-auto-Win2003_64-AS-prod  please wait...


Id                     : 376950c8-1a55-4602-b75c-3e538693fbe6
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:15:53.
Name                   : rep001-005-auto-Win2003_64-AS-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-005-auto-Win2003_64-AS-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage
                         >True</IsFirstUsage><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions
                         >
ScheduleOptions        : Start time: [19.04.2012 00:20:57], Latest run time: [19.04.2012 00:15:57], Next run time: [], Retry times on failure: [3], Retry timeout: [10 min], Daily options: [Enabled: True, DayNumberIn
                         Month: Everyday, Days: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: S
                         aturday, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <s
                         cheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
                         0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:16:01Z Information: Job rep001-005-auto-Win2003_64-AS-prod succesfully created.
2012-04-19 00:16:01Z Information: Job options set
Id                     : 376950c8-1a55-4602-b75c-3e538693fbe6
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:15:53.
Name                   : rep001-005-auto-Win2003_64-AS-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-005-auto-Win2003_64-AS-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage
                         >True</IsFirstUsage><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions
                         >
ScheduleOptions        : Start time: [19.04.2012 22:10:00], Latest run time: [19.04.2012 00:15:57], Next run time: [22:10:00], Retry times on failure: [2], Retry timeout: [22 min], Daily options: [Enabled: True, Day
                         NumberInMonth: SelectedDays, Days: Monday, Tuesday, Wednesday, Thursday, Friday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of Week: Saturda
                         y, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleString: <schedul
                         er><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</T
                         uesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:16:14Z Information: Job scheduling options set
2012-04-19 00:16:14Z Information: VSS is enabled
Id                     : 376950c8-1a55-4602-b75c-3e538693fbe6
Info                   : Veeam.Backup.Model.CDbBackupJobInfo
JobType                : Backup
SourceType             : VDDK
JobTargetType          : Backup
TargetType             : Other
TypeToString           : VMware Backup
Description            : Created by Powershell at 19.04.2012 00:15:53.
Name                   : rep001-005-auto-Win2003_64-AS-prod
BackupPlatform         : EVmware
TargetHostId           : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir              : E:\BackupRepository1
TargetFile             : rep001-005-auto-Win2003_64-AS-prod
Options                : Veeam.Backup.Model.CJobOptions
IsContinuous           : False
HvReplicaTargetOptions : Veeam.Backup.Model.CDomHvReplicaTargetOptions
BackupStorageOptions   : Veeam.Backup.Model.CDomBackupStorageOptions
BackupTargetOptions    : Veeam.Backup.Model.CDomBackupTargetOptions
HvSourceOptions        : Veeam.Backup.Model.CDomHvSourceOptions
JobOptions             : Veeam.Backup.Model.CDomJobOptions
NotificationOptions    : Veeam.Backup.Model.CDomNotificationOptions
PostJobCommand         : Veeam.Backup.Model.CDomPostJobCommand
ViReplicaTargetOptions : Veeam.Backup.Model.CDomViReplicaTargetOptions
ViSourceOptions        : Veeam.Backup.Model.CDomViSourceOptions
VssOptions             : <CVssOptions><Enabled>False</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>Domain\Username</UserName><Password>AQAAANCMnd8BFd
                         ERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAC5JmzNwqsx5GGMh0Biyr9tAAAAAASAAACgAAAAEAAAAFNjztIHSZuSDY6d+SCxspAQAAAAFxrfYNGeqtmHPy//igXOeRQAAABqy9yGwnMcjVKqznDc2uJmkh9S
                         7Q==</Password><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsag
                         e><IncludedIndexingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ScheduleOptions        : Start time: [19.04.2012 22:10:00], Latest run time: [19.04.2012 00:15:57], Next run time: [04/19/2012 22:10:00], Retry times on failure: [2], Retry timeout: [22 min], Daily options: [Enabled
                         : True, DayNumberInMonth: SelectedDays, Days: Monday, Tuesday, Wednesday, Thursday, Friday]Monthly options: [Enabled: False, Time: 19.04.2012 22:00:00, Day Number In Month: Fourth, Day Of We
                         ek: Saturday, Months: January, February, March, April, May, June, July, August, September, October, November, December]Periodically options: [Enabled: False, Period: 1 hour(s), ScheduleStrin
                         g: <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                         ,0,0,0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0,0,0,0,0,0,0,0,0,0,0,0,0,
                         0,0,0,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>]Continuous options: [Enabled: False]
IsScheduleEnabled      : True
IsInitialReplica       : False
IsBackup               : True
IsSnapshotReplica      : False
IsLegacyReplica        : False
IsReplica              : False
IsVmCopy               : False

2012-04-19 00:16:26Z Information: VSS Default Options set
2012-04-19 00:16:26Z Information: VSS Enabled
Id                  : 2f21617f-843e-4a08-ab36-53760827555e
Object              : Name: pASV0816
Filter              : 
Name                : pASV0816
Type                : Include
Location            : vcenter.demolab.an.veeam.de\demolab\demolab Cluster\Produktiv\pASV0816
ApproxSizeString    : 0,0 KB
Info                : Veeam.Backup.Model.CDbObjectInJobInfo
JobId               : 376950c8-1a55-4602-b75c-3e538693fbe6
IsFolder            : False
IsIncluded          : True
IsVssChild          : False
IsExcludeDisksChild : False
IsExcluded          : False
IsExtended          : False
PolicyType          : None
VssOptions          : <CVssOptions><Enabled>True</Enabled><IgnoreErrors>True</IgnoreErrors><GuestFSIndexingType>None</GuestFSIndexingType><Credentials><UserName>demolab\Administrator</UserName><Password>AQAAANCMnd8B
                      FdERjHoAwE/Cl+sBAAAAVgWsSXAIVkCUHMX+Pm+sHgAAAAACAAAAAAADZgAAqAAAABAAAAC4yXQk/UKZmovXEkf3ZJ/GAAAAAASAAACgAAAAEAAAAK+Vf820F/lTr7n++yTHwC8IAAAAfbdLG+9KPOgUAAAA76gn17WOmARBwWE5w6cAYNcju+k=</Passwor
                      d><IsLocalProtect>False</IsLocalProtect><CurrentUser>False</CurrentUser></Credentials><TransactionLogsTruncation>Never</TransactionLogsTruncation><IsFirstUsage>True</IsFirstUsage><IncludedIndex
                      ingFolders /><ExcludedIndexingFolders><string>%windir%</string><string>%ProgramFiles%</string><string>%TEMP%</string></ExcludedIndexingFolders></CVssOptions>
ExtendedOptions     : Veeam.Backup.Model.COijExtendedOptions
DiskFilter          : 2000;2001;2002;2003;2004;2005;2006;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2040;204
                      1;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063
UpdateConfig        : True

2012-04-19 00:16:38Z Information: VSS VM credentials set
2012-04-19 00:16:38Z Information: Finished with job options
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2012-04-19 00:16:38Z Information: Job started at  2012-04-19 00:14:59Z
2012-04-19 00:16:38Z Information: Job finished at  2012-04-19 00:16:38Z
2012-04-19 00:16:38Z Information: VM:  pASV0816
2012-04-19 00:16:38Z Information: Jobname:  rep001-005-auto-Win2003_64-AS-prod
2012-04-19 00:16:38Z Information: Job Finished successfully
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests