tabush
asked on
Veeam Start-VBRZip powershell script (ET)
I am trying to write a powershell script to perform VeeamZIP on certain VMs. This article explains how to do it (page 746) but i cannot seem to get it right because i keep getting errors with my syntax.
https://www.veeam.com/pdf/guide/veeam_backup_9_0_powershell_reference_en.pdf
This is what i wrote so far:
Also i have about 10 vms that i want to run this on. Can i combine them all into one script so it starts the next server when the previous one finishes.
https://www.veeam.com/pdf/guide/veeam_backup_9_0_powershell_reference_en.pdf
This is what i wrote so far:
Add-PSSnapin VeeamPSSnapin
$ServerName = Find-VBRHvEntity -Server localhost -Name 'OSNY2k12PS01'
Start-VBRZip -Folder "D:\VMBackup" -Entity $ServerName -Compression 5 -DisableQuiesce -AutoDelete In1Week
Also i have about 10 vms that i want to run this on. Can i combine them all into one script so it starts the next server when the previous one finishes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
I tried it with NYC ESX and this is the error im getting:
and in the script that i wrote (posted above) this is the error i was getting:
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:21 char:2
+ - High, 9 - Extreme)
+ ~
Missing expression after unary operator '-'.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:21 char:3
+ - High, 9 - Extreme)
+ ~~~~
Unexpected token 'High' in expression or statement.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:21 char:7
+ - High, 9 - Extreme)
+ ~
Missing argument in parameter list.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:21 char:20
+ - High, 9 - Extreme)
+ ~
Unexpected token ')' in expression or statement.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:117 char:101
+ ... | select -first
+ ~
Missing closing ')' in expression.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:119 char:1
+ 1).Title}})
+ ~
Unexpected token '1' in expression or statement.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:117 char:38
+ {$_.EndTime}},Result,@{n="Details";e ={($TaskSe ssions | sort creationtime -Descen ...
+ ~
Missing closing '}' in statement block.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:119 char:2
+ 1).Title}})
+ ~
The hash literal was incomplete.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:79 char:1
+ {
+ ~
Missing closing '}' in statement block.
At C:\Users\networkadmin\Desktop\VeeamZ IP.ps1:119 char:11
+ 1).Title}})
+ ~
Unexpected token ')' in expression or statement.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator
and in the script that i wrote (posted above) this is the error i was getting:
Find-VBRHvEntity : Cannot process argument transformation on parameter 'Server'. Host with name 'localhost'
was not found
At C:\Users\networkadmin\Desktop\Veeam Backup Script.ps1:2 char:40
+ $ServerName = Find-VBRHvEntity -Server localhost -Name 'OSNY2k12PS01'
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Find-VBRHvEntity], ParameterBindingArgumentTransformati onExc
eption
+ FullyQualifiedErrorId : ParameterArgumentTransformationError ,Veeam.Bac kup.PowerS hell.Comma nd.FindVBR Hv
Entity
Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value
for the argument, and then try running the command again.
At C:\Users\networkadmin\Desktop\Veeam Backup Script.ps1:3 char:44
+ Start-VBRZip -Folder "D:\VMBackup" -Entity $ServerName -Compression 5 -DisableQu ...
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Vee am.Backup. PowerShell .Commands. Backup.Sta rt
VBRZip
In your screenshot above, it looks like your vCenter would be the 192.168.x.x address. Below that is the Datacenter, Cluster, then hosts.
Make sure to use the hostname as you see it in Veeam (I think it's always the full FQDN).
Looks like all those errors are likely from a poor copy and paste of the script, or maybe editing with something that changed the file, or a missing quote.
Lastly, are you backing up Hyper-V or VMWare? Make sure you're using the right cmdlet for each.
Make sure to use the hostname as you see it in Veeam (I think it's always the full FQDN).
Looks like all those errors are likely from a poor copy and paste of the script, or maybe editing with something that changed the file, or a missing quote.
Lastly, are you backing up Hyper-V or VMWare? Make sure you're using the right cmdlet for each.
ASKER
I downloaded the script straight to the server this time so no copy-pasting but getting a different error now.
It seems that its not recognizing the $server variable
It seems that its not recognizing the $server variable
Find-VBRViEntity : Cannot validate argument on parameter 'Server'. The argument is null. Provide a valid
value for the argument, and then try running the command again.
At C:\Users\networkadmin\Downloads\Veea mZIP-VI-up dated\Veea mZIP (VI - updated).ps1:76 char:48
+ $VM = Find-VBRViEntity -Name $VMName -Server $Server
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Find-VBRViEntity], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Vee am.Backup. PowerShell .Command.F indVBRViEn ti
ty
Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value
for the argument, and then try running the command again.
At C:\Users\networkadmin\Downloads\Veea mZIP-VI-up dated\Veea mZIP (VI - updated).ps1:86 char:40
+ $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+ ~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Vee am.Backup. PowerShell .Commands. Backup.Sta rt
VBRZip
Is the $Hostname variable set correctly for your environment? Make sure the following line returns info.
Get-VBRServer -name $HostName
The script uses that to set the $server variable. And then that is used in the next command.Find-VBRViEntity -Name $VMName -Server $Server
Running that command manually should also return info.
ASKER
Sorry for the delayed response. Yes that command worked.
I also did ECHO $HostName
and it did output the correct hostname that i entered.
I also did ECHO $HostName
and it did output the correct hostname that i entered.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER