PowerShell script exchange
Post Reply
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

Veeam powershell colume?code?

Post by shahn »

i wanna make powershell script.

but, i did not found powershell colume.

Like,

Code: Select all

@{n='StartTime';e={$_.Progress.StartTimeLocal}}, 
@{n='EndTime';e={$_.Progress.StopTimeLocal}},
@{n='TransferedSizeinMB';
e={[math]::Round(($_.Progress.TransferedSize/1048576),2)}}}
etc..

i want to know Veeam Web Address in colume list
Mildur
Product Manager
Posts: 10277
Liked: 2746 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam powershell colume?code?

Post by Mildur »

Hello Shahn

Can you provide more detailed information about your goal?
What Veeam Web Address (https://******) are you looking for?

Best,
Fabian
Product Management Analyst @ Veeam Software
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

Re: Veeam powershell colume?code?

Post by shahn »

veeam powershell varibles?
like $_.Progress.StartTimeLocal or $_.Status

i want to show more result on powershell script
david.domask
Veeam Software
Posts: 2573
Liked: 603 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam powershell colume?code?

Post by david.domask »

Hi shahn,

Can you maybe write out an example of how the output should be? It looks to me like you're trying to create a PSCustomObject (I think we discussed this in another thread), but I'm not quite clear on the intended output.

Similarly, you mention Veeam Web Address; I'm afraid I don't quite get your goal here, so can you explain a bit more or show what you're trying to achieve? We can better advise if you provide perhaps an example output made by hand.
David Domask | Product Management: Principal Analyst
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

Re: Veeam powershell colume?code?

Post by shahn »

I used next script. (ps1)

Code: Select all

$TaskSessions = @()
$sessions = Get-VBRComputerBackupJobSession | Where-Object{$_.CreationTime -ge (Get-Date).AddDays(-$day)}
foreach ($session in $sessions) {
  $TaskSessions += Get-VBRTaskSession -Session $session | Select-Object -Property Jobname,@{n='Job';e={$_.JobTypeString}},@{n='Result';e={$_.Status}},@{n='StartTime';e={$_.Progress.StartTimeLocal}},@{n='EndTime';e={$_.Progress.StopTimeLocal}},@{n='Backup MB';e={[math]::Round(($_.Progress.TransferedSize/1024/1024))}} 
}

$TaskSessions | Sort -Property JobName, StartTime -Descending | Format-Table -Autosize >> $reportdir\report-$dt.csv
[result]

Code: Select all

JobName                       Result StartTime             EndTime               Backup MB
-------                       ------ ---------             -------               ---------
restore point - 192.168.0.40 Success 2024-04-17 오후 3:21:03 2024-04-17 오후 3:23:24      2476
restore point - 192.168.0.40 Success 2024-04-17 오후 3:00:33 2024-04-17 오후 3:02:56         0
restore point - 192.168.0.40 Success 2024-04-17 오후 2:11:51 2024-04-17 오후 2:14:11      2476
restore point - 192.168.0.40 Success 2024-04-17 오후 1:14:42 2024-04-17 오후 1:19:07      9499
[TO-BE]

Code: Select all

JobName                                 Result        StartTime                           EndTime                            Backup MB    JobType
-------                       ------ ---------             -------               ---------
restore point - 192.168.0.40     Success     2024-04-17 오후 3:21:03     2024-04-17 오후 3:23:24      2476             full
restore point - 192.168.0.40     Success     2024-04-17 오후 3:00:33     2024-04-17 오후 3:02:56         0                incremental
restore point - 192.168.0.40     Success     2024-04-17 오후 2:11:51     2024-04-17 오후 2:14:11      2476              full
restore point - 192.168.0.40     Success     2024-04-17 오후 1:14:42     2024-04-17 오후 1:19:07      9499              full
i need column intervel , and Jobtype add
david.domask
Veeam Software
Posts: 2573
Liked: 603 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Veeam powershell colume?code?

Post by david.domask »

Got it, so you need to add something to your Select-Object on line 4:

Code: Select all

$TaskSessions = @()
$sessions = Get-VBRComputerBackupJobSession | Where-Object{$_.CreationTime -ge (Get-Date).AddDays(-$day)}
foreach ($session in $sessions) {
  $jSessType = (Get-VBRBackupSession -Id $session.id).JobType.ToString()
  $TaskSessions += Get-VBRTaskSession -Session $session | Select-Object -Property Jobname, $jSessType, @{n='Job';e={$_.JobTypeString}},@{n='Result';e={$_.Status}},@{n='StartTime';e={$_.Progress.StartTimeLocal}},@{n='EndTime';e={$_.Progress.StopTimeLocal}},@{n='Backup MB';e={[math]::Round(($_.Progress.TransferedSize/1024/1024))}} 
}

$TaskSessions | Sort -Property JobName, StartTime -Descending | Format-Table -Autosize >> $reportdir\report-$dt.csv
I added a way to get the JobType from Get-VBRBackupSession CBackupSession object, then just add that to the Select statement. You can add it wherever you want, I just put it 2nd for convenience.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests