PowerShell script exchange
Post Reply
Da PAN
Lurker
Posts: 1
Liked: never
Joined: Nov 10, 2010 2:44 pm
Contact:

How do I set DiskFilter and other exclude parameters

Post by Da PAN »

Hello,

we are backing up just the system disk of nearly all (VMware) VMs. So we have to add the VMs to a backup job, edit the exclusions, edit every VM to exclude all disks apart from the system disk, change the checkbox "remove disk from backuped VM". This is a part of work we would like to automate. Creating job and adding VMs with Powershell is no problem but how do I change the settings mentioned above for each VM?

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

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

Unfortunately, for now it seems to be a general limitation that DiskFilter options can’t be specified, at least, I don’t know a way how it can be done.

Thanks.
mdivis
Lurker
Posts: 1
Liked: never
Joined: Sep 24, 2013 6:49 am
Full Name: Martin Divis
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by mdivis »

this works, though I do no know how far supported it is:

Code: Select all

$job = Get-VBRJob -name test
$objects = $job.GetObjectsInJob()
$object = $objects | where {$_.name -eq 'other64'}
$objInfo = $object.info
$objInfo.diskFilter = '2000;2005'
[Veeam.Backup.Core.CObjectInJob]::Update($objInfo)
will restrict vm's 'other64' backup to disks SCSI0:0 and SCSI0:5
decoy5657
Influencer
Posts: 12
Liked: 3 times
Joined: Oct 09, 2013 2:45 pm
Full Name: Aaron Anderson
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by decoy5657 »

Here's a little code block I use. I update my jobs daily w/ a powershell script. SQL boxes only get the system disk w/ Veeam. So I Just added a loop to what mdivis posted.

Code: Select all

$SQLjob = Get-VBRJob -name SQL
$SQLobjects = $SQLjob.GetObjectsInJob()

ForEach ($SQLobject in $SQLobjects)
{
$SQLobjInfo = $SQLobject.info
$SQLobjInfo.diskFilter = '2000'
[Veeam.Backup.Core.CObjectInJob]::Update($SQLobjInfo)
}
slide999
Novice
Posts: 5
Liked: never
Joined: Sep 25, 2014 9:40 pm
Full Name: Kevin
Contact:

[MERGED] : Can I modify exclusions via PowerShell

Post by slide999 »

Support Case 00642976

Hi - I was wondering if/how I can modify via PowerShell the 'virtual machine exclusions'? I just want disks 0:0 and 0:1 backed. Thanks in advance.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

Hi Kevin,

It should be possible with the use of creative workarounds provided above.

Thanks.
MrJH
Influencer
Posts: 14
Liked: 2 times
Joined: Aug 18, 2015 2:01 pm
Contact:

[MERGED] Backup particular drive of a VM?

Post by MrJH »

Is this possible? We have a VM with 3 data drives, but I only wish to specify a particular one for backup. Is there a Veeam PS switch for this?
Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

Check the solution coined above. Thanks.
dperabo
Influencer
Posts: 10
Liked: never
Joined: Aug 14, 2015 12:21 pm
Full Name: Daniel
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by dperabo »

Hi,
is there a way to disable the diskfilter with powershell?
i need "All disks" :mrgreen:

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

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

Check the following script:

Code: Select all

asnp VeeamPSSnapin
$job = Get-VBRJob -name "Name of your Job"
$objects = $job.GetObjectsInJob()
ForEach ($object in $objects)
{
$ObjectInfo = $Object.info
$objectinfo.diskfilter = '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;16007;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;16037;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;16067;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;16097;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;32015;32016;32017;32018;32019;32020;32021;32022;32023;32024;32025;32026;32027;32028;32029;32030;32031;32032;32033;32034;32035;32036;32037;32038;32039;32040;32041;32042;32043;32044;32045;32046;32047;32048;32049;32050;32051;32052;32053;32054;32055;32056;32057;32058;32059'
[Veeam.Backup.Core.CObjectInJob]::Update($ObjectInfo)
}
Thanks!
dperabo
Influencer
Posts: 10
Liked: never
Joined: Aug 14, 2015 12:21 pm
Full Name: Daniel
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by dperabo »

Thanks a lot, I was thinking about this solution but i didn't think
it would put the hook (translate bei google :D )
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

You're welcome. Should other help be needed, feel free to reach us. Thanks!
rverhe
Influencer
Posts: 11
Liked: never
Joined: Dec 01, 2014 12:50 pm
Full Name: Rob Verhees
Contact:

[MERGED] Veeam Udpate 4 JobobjectDiskfilter

Post by rverhe »

Goodmorning,

With Veeam Update 4 the jobobject diskfilter property is changed in PowerShell.
Have some issues with setting it to "selected disks", any idea how to archive this with the new commands?

When trying to change it, it says "ReadOnly Property"

Key DisplayName
--- -----------
IDE 0:0 (3000) IDE (0:0)
IDE 0:1 (3001) IDE (0:1)
IDE 1:0 (3002) IDE (1:0)
IDE 1:1 (3003) IDE (1:1)
SCSI 0:0 (2000) SCSI (0:0)
SCSI 0:1 (2001) SCSI (0:1)
SCSI 0:2 (2002) SCSI (0:2)
rverhe
Influencer
Posts: 11
Liked: never
Joined: Dec 01, 2014 12:50 pm
Full Name: Rob Verhees
Contact:

Re: Veeam Udpate 4 JobobjectDiskfilter

Post by rverhe »

Update:

--> Current Diskfilter

PS C:\WINDOWS\system32> $jobobject.diskfilter

Disks DiskNamePatterns IsVer8Format
----- ---------------- ------------
{IDE (0:0), IDE (0:1), IDE (1:0), IDE (1:1)...} {} True

--> Created Diskfilter Object

PS C:\WINDOWS\system32> $an

Disks DiskNamePatterns IsVer8Format
----- ---------------- ------------
{SCSI (0:0)} {} True


PS C:\WINDOWS\system32> $jobobject.diskfilter = $an
The property 'diskfilter' cannot be found on this object. Verify that the property exists and can be set.

Or

PS C:\WINDOWS\system32> [Veeam.Backup.Core.CObjectInJob]::Update($an)
Cannot convert argument "oijInfo", with value: "Veeam.Backup.Core.CDiskFilter", for "Update" to type "Veeam.Backup.Model.CDbObjectInJobInfo": "Cannot convert the "Veeam.Backup.Core.CDiskFi
lter" value of type "Veeam.Backup.Core.CDiskFilter" to type "Veeam.Backup.Model.CDbObjectInJobInfo".
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

What exact disks you have to have selected? Thanks!
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by jhoughes »

I had shown someone how to do this recently to set a tag object as an exclude and used the Update method for this.

Post is here: post314628.html#p314628
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
rverhe
Influencer
Posts: 11
Liked: never
Joined: Dec 01, 2014 12:50 pm
Full Name: Rob Verhees
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by rverhe »

Hello Guys,

I found how to change the diskfilter using PowerShell after Veeam 9.5 Update 4.
Edited my previous blog with my new findings:

http://robvit.com/veeam/backup_replicat ... powershell
theq77
Novice
Posts: 7
Liked: 1 time
Joined: Apr 02, 2019 3:06 pm
Full Name: theq
Contact:

[MERGED] Exclude Disk with powershell

Post by theq77 »

I want to exclude SCSI disks from a backup job.

I found this Information:
http://robvit.com/veeam/backup_replicat ... owershell/
powershell-f26/add-vm-s-to-exclusions-list-t21575.html

when I add the vm with
Add-VBRViJobObject -Job $jobname -Entities (Find-VBRViEntity -Name $vmname)
Get-VBRJobObject -Job $jobname -Name $vmname | Remove-VBRJobObject

I get the VM in Exclusions/VMs but not in Exclusions/Disks, where it should be.

Any ideas?

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

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

What exact SCSI disks you're trying to exclude (0:1, 0:2, etc.)? Or you're trying to exclude them all? Thanks!
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by jhoughes »

The 'Remove-VBRJobObject' cmdlet will set the entire VM as an excluded object from a job.

If you are looking to exclude only specific disks, that is where you want to follow Rob's post about the DiskArray object creation and the Update method of the job object itself.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
theq77
Novice
Posts: 7
Liked: 1 time
Joined: Apr 02, 2019 3:06 pm
Full Name: theq
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by theq77 »

Thx for the fast answers.
As I understand, I have to add the vm to the disk exclusion list and then add the SCSI disks.
While adding the SCSI disks works fine, I have an issue adding the vm.

When I add the VM via
Add-VBRHvJobObject -Job $JobName -Entities (Find-VBRHvEntity -Name $VM)
the machine also appears in the list 'Virtual Machines to backup' - but the vm is already in the list via the Cluster, which should be backuped. The VM is also in the "disk exclusion" list. That is good, because I can add the disks to be excludes. When I add the VM via the VEEAM Console, the VM is not in the 'Virtual Machines to backup' list, but only in the "disk exclusion" list!

When I Remove the VM via
Get-VBRJobObject -Job $jobname -Name $vm | Remove-VBRJobObject
the VM is not longer in the "Virtual Machines to backup" list - and it is also moved from the "disk exclusion" list to the "VM exclusion" list. So it is no longer possible to add a disk.

So my questions are:
* What do I have to do, to have the VM only in the "disk exclusion" list like it would be via the console?
* What is the impact of the vm beeing listed in "Virtual Machines to backup"

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

Re: How do I set DiskFilter and other exclude parameters

Post by veremin »

Can you tell us whether you want to:

- Exclude a certain VM form processing
- Or exclude certain disk of certain VM from processing

Thanks!
theq77
Novice
Posts: 7
Liked: 1 time
Joined: Apr 02, 2019 3:06 pm
Full Name: theq
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by theq77 »

I want to exclude certain disk of certain VM from processing.

In the backup Job the vm is not listed directly, but only the Cluster the vm is in.
Shinji
Veteran
Posts: 290
Liked: 14 times
Joined: Jan 08, 2019 6:04 am
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by Shinji »

One of our customers wants to create a backup job including system disk only or selected disk by PowerShell.
Is this possible?
I am not familiar with PowerShell.

I am also trying to find restore job with same rule.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by oleg.feoktistov »

Hi

Since you cannot change Disk Filter Mode directly over a job object as it is a read-only property, you can configure your disk filter preferences
using one of these scripts shared earlier in this thread.
System disk usually corresponds to IDE (0:0) with the key "3000", so you would need to update disk filter options with "3000" to include system disk only.
As for a specific volume restore, I would advise to have a look at this thread.

Oleg
Shinji
Veteran
Posts: 290
Liked: 14 times
Joined: Jan 08, 2019 6:04 am
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by Shinji »

Thank you very much!
I will tell this information to the customer.
tomo yasu
Veeam Software
Posts: 117
Liked: 3 times
Joined: Feb 14, 2021 6:06 am
Full Name: tomohiro yasuda
Contact:

Re: How do I set DiskFilter and other exclude parameters

Post by tomo yasu »

I want to use PowerShell to change the target disk for a backup job. I was asked the following question.
I want to use only the system disk. How to set "Disk0:0 only".
I looked at the following URL
This was how to add a disk with "select disk".
http://robvit.com/veeam/backup_replicat ... powershell
Is it possible to specify "Disk0:0 only"?
Also, is specifying $DKeys = "2000" or $DKeys = "3000" in the URL method the same result as "Disk0:0 only"?
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests