PowerShell script exchange
Post Reply
GianlucaCroci
Expert
Posts: 231
Liked: 22 times
Joined: Feb 26, 2019 12:08 pm
Full Name: Gianluca Croci
Contact:

Tags combination

Post by GianlucaCroci »

I would like to start taking advantage of the wonderful feature of version 11 which is the ability to save VMs in a job by combining tags.

Today we've different jobs that save Windows VMs on a daily, weekly and monthly basis. Or the Linux VMs daily, weekly and monthly, as well as the VMs of the DM, of Test, and more.

Our VMs are split into 3 VCenters, and we don't want to mix VMs. For this reason, a Tag has been associated with each DataCenter.
In the Vcenters, under the Datacenter, we've a folder by type of VM (e.g. Domain Controller, Print Server, Networking, Monitoring, Laboratory, ...)
In each of these we've created Daily, Weekly and Monthly subfolders. In these, as for the folders, we've assigned tags.

Using the combination of Tags I'd like to backup the VMs of "VCenter1" "Networking" "Windows" "Daily" using the respective Tags.

For the VCenter part as well as the folder by type of VM, and "Daily", "Weekly", ... there is no problem.
I don't know how, if not to put a Tag on each VM, to know if it's Windows or Linux.
Some idea?

Today we differentiate Windows from Linux for the Quiescence discourse. Do you think the servers would be better to backup them without quiescence, and use it only in some cases or not?


Is it possible via PowerShell to extract a list of all Veeam JOBs with the list of Virtual Machines, or rather the tag or cluster or machine name inserted in the job?

Is it possible, again via PowerShell, to insert an exclusion or remove it from a Job?



Thank's in advance for any suggestions and help
foggy
Veeam Software
Posts: 21139
Liked: 2141 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Tags combination

Post by foggy »

Hi Gianluca, it is always recommended to use quiescence. Using tags for VM OS differentiation is the most solid approach - any particular considerations against it?

I will refer the PS-related questions to @oleg.feoktistov.

Thanks!
Gostev
Chief Product Officer
Posts: 31815
Liked: 7302 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Tags combination

Post by Gostev »

Seems to fit the PowerShell forum better anyway, so moving it there.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Tags combination

Post by oleg.feoktistov »

Hi Gianluca,

To list all Veeam jobs together with their includes use this script:

Code: Select all

$jobs = Get-VBRJob
foreach ($job in $jobs) {
  $objects = Get-VBRJobObject -Job $job
  $job | select Name, @{n='Includes';e={$objects.Name}}, JobType
}
As for the exclusions, currently it is possible to set them through powershell for NAS, Agent and vCD Replica jobs.

Thanks,
Oleg
GianlucaCroci
Expert
Posts: 231
Liked: 22 times
Joined: Feb 26, 2019 12:08 pm
Full Name: Gianluca Croci
Contact:

Re: Tags combination

Post by GianlucaCroci »

Thank's a lot at all.

executed the script but the third column was completed with ... because it was larger than 8 characters
Name JobType Includes
---- ------- --------
DMZ-Monthly Backup {Moni...
modified as follows
$job | select Name, JobType, @{n='Includes';e={$objects.Name}} | Format-Table -AutoSize
However, the script doesn't correctly report all includes. If I compare them with the Jobs, I find listed servers that I've not actually put in the jobs.


So if I understand correctly there is no way in Veeam or in Vmware to pass the operating system, but I'll have to put a Tag where I indicate which operating system is used.
And this is because it's always better to use quiescence, even if in many cases we may not need it because in the case of databases it's the software that performs a backup (we backup the entire VM including the backup generated) and in many cases they're only files generated or saved.

Thank's again
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Tags combination

Post by oleg.feoktistov »

Hi Gianluca,

That's weird. This script works fine in my lab.
As for the operating system, we can get this info from hierarchy object. Example:

Code: Select all

$jobs = Get-VBRJob
foreach ($job in $jobs) {
  $objects = Get-VBRJobObject -Job $job
    $objectsArray = @()
  foreach ($object in $objects) {
    $objectsArray += $object.Name
  }

  $osName = $object.GetObject().GuestInfo.GetGuestOsName()
  $job | select Name, @{n='Includes';e={$objectsArray}}, @{n='OS';e={$osName}}, JobType | fl
} 
If that's not the OS info you are seeking, please, let me know.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests