#load Veeam Powershell Snapin
Add-PSSnapin -Name VeeamPSSnapIn # -ErrorAction SilentlyContinue
$jobs = get-vbrjob | ?{$_.jobtype -eq "Replica"}
foreach ($job in $jobs) {
$Sessions = Get-VBRBackupSession | ?{$_.jobid -eq $job.id}
foreach ($session in $sessions) {
$tasks = Get-VBRTaskSession $session
foreach ($task in $tasks) {
# Print the name of each VM each time it was replicated
$VM_name = $task.name
$VM_name
# $task should contain the information about each time a VM was replicated
}
}
}
I get strange data, so I am not sure I am implementing the right loop.
Can anybody please suggest the best loop in terms of accuracy and efficiency?
Regards
Marius
You mean you want to understand how many times a VM was replicated successfully? Is it your real code or just an example with some omissions (meaning $Sessions and $Tasks assignment is not included in the provided example for the purpose of simplicity)?
What about my original question? Are you looking for getting some counter, suggesting how many time VM was replicated, or some different information regarding replication tasks should be provided? Thanks.
Thank you for your question.
Once I get $task for every time each VM was replicated by each job I can get other information, i.e. the start and stop time, the replica status, and so on.
I removed such information from my scipt sample.
In my real script the information I get look incomplete or inaccurate, so I suspect there is some logic error in the loop...
That's the reason because I look for advice...
Regards
marius
If I were you, I would write something like the following. Currently the table contains only job name, VM name (session name), and the session status. Feel free to add whatever session-specific information you want to:
returns the status of the replica (the VM was replicated or not or there was a warning), how can I get the amount of data that were transferred for a specific VM (in the report it is the "Transfered" column)?
Regards
Marius
You're welcome. If you need any other task session specific property to be added to the table, just check task session entity, see what particular members it has, and then add the required property as an additional column (the same way the other four have been already added). Thanks.
Let me provide an additional clarification: the data I need to get is the one displayied in the column "Transferred" for each VM in the report and is expressed in GB.
Regards
Marius
Glad to hear that. It's all about PowerShell byte conversion, in PowerShell you can divide the resulting number by 1KB, 1MB, 1GB, etc. whatever value you prefer. Thanks.
Hi All, I am New to VEEAM and POWERSHELL. Is there a way/script to get list of VM's of which read and transferred size is 0.0 B from all backup schedules.
Thanks again, below is the output i got from the command.. I need to get VM names in place of JOB name.
DLY_SCHED_VMBKP_ABFRL_CRITICAL_MSSQL_JOB20 session 02/21/2018 02:24:15 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_MSSQL_JOB21 session 02/26/2018 02:16:42 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_MSSQL_JOB23 session 02/21/2018 04:19:53 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_VMTOOLS_JOB03 session 06/17/2018 20:05:46 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_LINUX_JOB12 session 05/15/2018 00:07:07 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_VMTOOLS_JOB04 session 03/05/2018 04:38:54 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_VMTOOLS_JOB04 session 02/27/2018 20:52:18 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_VMTOOLS_JOB03 session 05/14/2018 20:35:09 TransferSize is zero
DLY_SCHED_VMBKP_ABFRL_CRITICAL_VMTOOLS_JOB04 session 01/15/2018 21:19:06 TransferSize is zero
I'm afraid it might be not possible to get those stats per-VM. Would you tell us why do you need that info? Are you trying to teck down those servers that do not generate any changes on their drives?