PowerShell script exchange
Post Reply
20100
Enthusiast
Posts: 72
Liked: 6 times
Joined: Feb 16, 2012 9:23 pm
Full Name: qq
Contact:

Script to document a backup job

Post by 20100 »

Hi

We need to document exactly how the backup are performed and we could not find any easy utility that provides a report, or file that describes the details of the process.
We looked at Powershell, but our knowledge is pretty limited, and the closest we got what that topic: http://forums.veeam.com/powershell-f26/ ... t3182.html but we could not get the list of VM.

Basically, we would be interested in a script that can list all the VM, and for each VM have the details for the following:
which disks are in the exceptions
Applications Aware Processing Options
Guest File System Indexing Options
Specific guest OS credential

Thanks in advance
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to document a backup job

Post by veremin » 1 person likes this post

Hi, Vincent,

Try the following example:

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Object = Get-VBRJobObject -Name "Name of VM" -Job $Job
$Object.DiskFilter #Disk info
$Object.VssOptions # AAIP options
$Object.VssOptions.WinGuestFSIndexingOptions #Win Guest Indexing Options
[Veeam.Backup.Core.CJobCredentials]::Find($Job.Id.Guid, $Object.id.Guid).CredentialsInfo.Credentials.UserName #Credentials name
I'm using quite complex way of getting name of credentials; sort of creative workaround. So, if someone finds less comprehensive way, let me know.

Thanks.
20100
Enthusiast
Posts: 72
Liked: 6 times
Joined: Feb 16, 2012 9:23 pm
Full Name: qq
Contact:

Re: Script to document a backup job

Post by 20100 »

Thanks Vladimir

the Disk info does not return the disks or the disk exceptions. Instead it displays the like of

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;204
5;2046;2047;2048;2049;2050;2051;2052;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063;16000;16001;16002;16003;16004;16
005;16006;16008;16009;16010;16011;16012;16013;16014;16015;16016;16017;16018;16019;16020;16021;16022;16023;16024;16025;1
6026;16027;16028;16029;16030;16031;16032;16033;16034;16035;16036;16038;16039;16040;16041;16042;16043;16044;16045;16046;
16047;16048;16049;16050;16051;16052;16053;16054;16055;16056;16057;16058;16059;16060;16061;16062;16063;16064;16065;16066
;16068;16069;16070;16071;16072;16073;16074;16075;16076;16077;16078;16079;16080;16081;16082;16083;16084;16085;16086;1608
7;16088;16089;16090;16091;16092;16093;16094;16095;16096;16098;16099;16100;16101;16102;16103;16104;16105;16106;16107;161
08;16109;16110;16111;16112;16113;16114;16115;16116;16117;16118;16119"
Also, the script works if I hardcode the name of the Job (I am OK with that) and also the name of the VM: I would have preferred that the script displays all the VM automatically. At this stage, I would be happy to have just the information for the disks (or/and disk exceptions) ie disk0, disk1, etc and then I can add the options for indexing/credentials later on.

Thanks
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to document a backup job

Post by veremin »

the Disk info does not return the disks or the disk exceptions. Instead it displays the like of
In fact, it returns exclusions. The provided portion just suggests that there are no disk exclusions specified for a given object. You can add some check, using which you will filter this long string out.

Also, you can add a loop to the referenced script to make it work with all jobs and source objects:

Code: Select all

asnp VeeamPSSnapin
foreach ($Job in (Get-VBRJob | where {$_.Jobtype -eq "Backup" -and $_.TypeToString -eq "Vmware Backup"}))
{

foreach ($Object in Get-VBRJobObject -Job $Job)
{
if ($Object.DiskFilter -like "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;2053;2054;2056;2057;2058;2059;2060;2061;2062;2063;16000;16001;16002;16003;16004;16005;16006;16008;16009;16010;16011;16012;16013;16014;16015;16016;16017;16018;16019;16020;16021;16022;16023;16024;16025;16026;16027;16028;16029;16030;16031;16032;16033;16034;16035;16036;16038;16039;16040;16041;16042;16043;16044;16045;16046;16047;16048;16049;16050;16051;16052;16053;16054;16055;16056;16057;16058;16059;16060;16061;16062;16063;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" -eq $True)
{
Write-Output $Object.name, "All disks"
}
Else
{
Write-Output $Object.name, $Object.diskfilter
}
}
}
Thanks.
20100
Enthusiast
Posts: 72
Liked: 6 times
Joined: Feb 16, 2012 9:23 pm
Full Name: qq
Contact:

Re: Script to document a backup job

Post by 20100 »

Thanks for this. It is what I was after.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script to document a backup job

Post by veremin »

You're welcome. Information regarding object AAIP settings can be also incorporated inside a loop, so that, you have it along with VM name and disk filter options.
albertwt
Veeam Legend
Posts: 879
Liked: 46 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Script to document a backup job

Post by albertwt »

veremin wrote: Mar 13, 2015 9:02 am Hi, Vincent,

Try the following example:

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Object = Get-VBRJobObject -Name "Name of VM" -Job $Job
$Object.DiskFilter #Disk info
$Object.VssOptions # AAIP options
$Object.VssOptions.WinGuestFSIndexingOptions #Win Guest Indexing Options
[Veeam.Backup.Core.CJobCredentials]::Find($Job.Id.Guid, $Object.id.Guid).CredentialsInfo.Credentials.UserName #Credentials name
I'm using quite complex way of getting name of credentials; sort of creative workaround. So, if someone finds less comprehensive way, let me know.

Thanks.
Hi Vladimir,

The script does not work due to the below error:

Code: Select all

Unable to find type [Veeam.Backup.Core.CJobCredentials].
At line:6 char:1
+ [Veeam.Backup.Core.CJobCredentials]::Find($Job.Id.Guid, $Object.id.Gu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Veeam.Backup.Core.CJobCredentials:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
Is this because of the new VBR v11 module deprecating the above class ?
--
/* Veeam software enthusiast user & supporter ! */
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Script to document a backup job

Post by oleg.feoktistov » 1 person likes this post

Hi,

It appears that this class no longer exists in v11. But it wasn't supported officially anyway, so I doubt we can consider it deprecated.
It is just no longer there.

Best regards,
Oleg
albertwt
Veeam Legend
Posts: 879
Liked: 46 times
Joined: Nov 05, 2009 12:24 pm
Location: Sydney, NSW
Contact:

Re: Script to document a backup job

Post by albertwt »

Yes, @oleg, that does make sense.

Thank you for the clarification.
--
/* Veeam software enthusiast user & supporter ! */
Post Reply

Who is online

Users browsing this forum: Max93 and 16 guests