PowerShell script exchange
Post Reply
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

Veeam Version and Excluded HDD

Post by SRedlin »

Hey folks,

which line of code tells me with version of veeam is installed?

Also which line of code tells me if a hdd from a vm is excluded of an backup job?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Version and Excluded HDD

Post by veremin »

1) Product version:

Code: Select all

$Path = "Path to Veeam.Backup.Core.dll" # Path to Veeam.Backup.Core.dll by default it's located in C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Core.dll
$Item = Get-Item -Path $Path
$Item.VersionInfo.ProductVersion
2) Disk exclusions:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of job"
$ObJect = Get-VBRJobObject -Job $Job -name "Name of VM"
$ObJect.info.DiskFilter
Thanks.
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

Re: Veeam Version and Excluded HDD

Post by SRedlin »

When i run the script against an job without any exclusions i get this output.

Ver8|3000;3001;3002;3003;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;2041;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;205
3;2054;2056;2057;2058;2059;2060;2061;2062;2063;16000;16001;16002;16003;16004;16005;16006;16008;16009;16010;16011;16012;16013;16014;16015;16
016;16017;16018;16019;16020;16021;16022;16023;16024;16025;16026;16027;16028;16029;16030;16031;16032;16033;16034;16035;16036;16038;16039;160
40;16041;16042;16043;16044;16045;16046;16047;16048;16049;16050;16051;16052;16053;16054;16055;16056;16057;16058;16059;16060;16061;16062;1606
3;16064;16065;16066;16068;16069;16070;16071;16072;16073;16074;16075;16076;16077;16078;16079;16080;16081;16082;16083;16084;16085;16086;16087
;16088;16089;16090;16091;16092;16093;16094;16095;16096;16098;16099;16100;16101;16102;16103;16104;16105;16106;16107;16108;16109;16110;16111;
16112;16113;16114;16115;16116;16117;16118;16119;32000;32001;32002;32003;32004;32005;32006;32007;32008;32009;32010;32011;32012;32013;32014;3
2015;32016;32017;32018;32019;32020;32021;32022;32023;32024;32025;32026;32027;32028;32029;32030;32031;32032;32033;32034;32035;32036;32037;32
038;32039;32040;32041;32042;32043;32044;32045;32046;32047;32048;32049;32050;32051;32052;32053;32054;32055;32056;32057;32058;32059


What does it mean?
Are the codes different when the d drive is excluded? Is the output for every letter the same or which logic is used ?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Version and Excluded HDD

Post by veremin »

What does it mean?
It means that there are no exclusions specified for this VM. All disks are included, in other words.
Are the codes different when the d drive is excluded? Is the output for every letter the same or which logic is used ?
If only some disks are selected for processing, the output will be different. For instance, in my case I'm only processing 3 disks, and this is the output I get:

Code: Select all

Ver8|2000;2001;2002
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

Re: Veeam Version and Excluded HDD

Post by SRedlin »

Ah okay so it seems there is no easy way to see which disks will be processed during a job.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Version and Excluded HDD

Post by veremin »

Not sure whether I follow you on that.

If you're processing all disks you will get an array similar to the one provided by you.

Code: Select all

Ver8|3000;3001;3002;3003;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;2041;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;205
3;2054;2056;2057;2058;2059;2060;2061;2062;2063;16000;16001;16002;16003;16004;16005;16006;16008;16009;16010;16011;16012;16013;16014;16015;16
016;16017;16018;16019;16020;16021;16022;16023;16024;16025;16026;16027;16028;16029;16030;16031;16032;16033;16034;16035;16036;16038;16039;160
40;16041;16042;16043;16044;16045;16046;16047;16048;16049;16050;16051;16052;16053;16054;16055;16056;16057;16058;16059;16060;16061;16062;1606
3;16064;16065;16066;16068;16069;16070;16071;16072;16073;16074;16075;16076;16077;16078;16079;16080;16081;16082;16083;16084;16085;16086;16087
;16088;16089;16090;16091;16092;16093;16094;16095;16096;16098;16099;16100;16101;16102;16103;16104;16105;16106;16107;16108;16109;16110;16111;
16112;16113;16114;16115;16116;16117;16118;16119;32000;32001;32002;32003;32004;32005;32006;32007;32008;32009;32010;32011;32012;32013;32014;3
2015;32016;32017;32018;32019;32020;32021;32022;32023;32024;32025;32026;32027;32028;32029;32030;32031;32032;32033;32034;32035;32036;32037;32
038;32039;32040;32041;32042;32043;32044;32045;32046;32047;32048;32049;32050;32051;32052;32053;32054;32055;32056;32057;32058;32059
If you're processing, say, only SCSI (0:0), you'll get the following string:

Code: Select all

Ver8|2000
Isn't that an indication of what disks are being processed?
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

Re: Veeam Version and Excluded HDD

Post by SRedlin »

Well that's indeed an indicator. But it's a lot of work in a script so translate those indicators. :)
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Version and Excluded HDD

Post by veremin »

You should not have any issues with only selected disks being processed, as it's not that hard to parse string containing, say, two or three values.

As to VM with all disks being backed up, I have one suggestion. The provided array has a certain length (1380 characters), so based on the length you can understand whether all VM disks are backed up.

Code: Select all

Asnp VeeamPSSNapin
$Job = Get-VBRJob -name "Job Name"
$Object = Get-VBRJobObject -Job $Job -name "Object Name"
if ($Object.DiskFilter.Length -eq 1380) {Write-Output "All disks of $($Object.name) are backed up"}
Thanks.
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

Re: Veeam Version and Excluded HDD

Post by SRedlin »

In Version 9.0.0.1491 i got a length of 1020 characters.

In Version 9.5.0.823 i got a length of 1380 characters.

In both cases where all discs processed. Seems that this information is different for each version. Can anbody confirm it and maybe tell the other version specific values?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Version and Excluded HDD

Post by veremin »

If I remember it correctly, those arrays look differently in 9.0 and 9.5, so it's expected that you got different representations.

Just keep that in mind while implementing scripts for different product versions.

As to other version specific values, typically with PS it's trial and error approach. Either check values you rely on beforehand or use unified product version.

Thanks.
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Veeam Version and Excluded HDD

Post by tsightler » 1 person likes this post

I've run across this issue before and use the following code to create the default disk filter (this code is VMware specific but there are similar helper functions for Hyper-V and vCD):

Code: Select all

$alldiskinclude = [Veeam.Backup.Core.CViDisksHelper]::CreateAllDiscsFilter()
This actually gives you a nice array with each disk key and display name that you can loop through if you want to determine the specific disks that are included. If you just want to string so you can compare the length you can do $alldiskinclude.Serial() and it will return a serialized string that is the same as the DiskFilter property of the object in job so you can do the comparison without requiring specific code for each version.

I believe this functions at least back to verison 8, but it's been I while since I've had a v8 instance in the lab, so I might be mistaken on that.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests