-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Enable Bitlooker - Powershell
I am trying to run this script on one of my VBR servers (9.5 Update 4a) but it fails to set the option. So my question is what is the option for setting this? Is there a guide to the options for jobs and the corresponding Powershell option somewhere?
Script -
asnp VeeamPSSNapin
foreach ($Job in Get-VBRJob | where {$_.JobType -eq "Backup" -or $_.JobType -eq "Replica"})
{
$Options = $Job.GetOptions()
$Options.ViSourceOptions.DirtyBlocksNullingEnabled = $True
$Job.SetOptions($Options)
}
Script -
asnp VeeamPSSNapin
foreach ($Job in Get-VBRJob | where {$_.JobType -eq "Backup" -or $_.JobType -eq "Replica"})
{
$Options = $Job.GetOptions()
$Options.ViSourceOptions.DirtyBlocksNullingEnabled = $True
$Job.SetOptions($Options)
}
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Enable Bitlooker - Powershell
I just verified that this worked successfully in my lab against 9.5U4a:
Job options prior to running code:
Job options after running code:
Code: Select all
$job = Get-VBRJob -Name 'AUSVCENTER-NoTag'
$joboptions = Get-VBRJobOptions -Job $job
$joboptions.ViSourceOptions.ExcludeSwapFile = $true
$joboptions.ViSourceOptions.DirtyBlocksNullingEnabled = $true
Set-VBRJobOptions -Job $job -Options $joboptions
Code: Select all
(Elevated) jhoughes@AUSDEV01 : D:\Code : 6/26/2019 08:57:28 :
> $job = Get-VBRJob -Name 'AUSVCENTER-NoTag'
(Elevated) jhoughes@AUSDEV01 : D:\Code : 6/26/2019 08:57:48 :
> $job.Options.ViSourceOptions
EncryptLanTraffic : False
FailoverToNetworkMode : False
VCBMode : san
VDDKMode : san;nbd
UseChangeTracking : True
EnableChangeTracking : True
VMToolsQuiesce : True
VmAttributeName : Veeam_Backup_Time
BackupTemplates : True
ExcludeSwapFile : False
DirtyBlocksNullingEnabled : False
BackupTemplatesOnce : True
SetResultsToVmNotes : True
VmNotesAppend : True
Code: Select all
(Elevated) jhoughes@AUSDEV01 : D:\Code : 6/26/2019 08:59:05 :
> $job = Get-VBRJob -Name 'AUSVCENTER-NoTag'
(Elevated) jhoughes@AUSDEV01 : D:\Code : 6/26/2019 08:59:11 :
> $job.Options.ViSourceOptions
EncryptLanTraffic : False
FailoverToNetworkMode : False
VCBMode : san
VDDKMode : san;nbd
UseChangeTracking : True
EnableChangeTracking : True
VMToolsQuiesce : True
VmAttributeName : Veeam_Backup_Time
BackupTemplates : True
ExcludeSwapFile : True
DirtyBlocksNullingEnabled : True
BackupTemplatesOnce : True
SetResultsToVmNotes : True
VmNotesAppend : True
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Enable Bitlooker - Powershell
I tried your script and got the following so something is off in my environment -
Code: Select all
The property 'DirtyBlocksNullingEnabled' cannot be found on this object. Verify that the property exists and can be
set.
At C:\Users\blackbird\Documents\Dirty_Blocks_Enable_3.ps1:4 char:1
+ $joboptions.ViSourceOptions.DirtyBlocksNullingEnabled = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
Set-VBRJobOptions : Cannot convert 'System.Object[]' to the type 'Veeam.Backup.Model.CJobOptions' required by
parameter 'Options'. Specified method is not supported.
At C:\Users\blackbird\Documents\Dirty_Blocks_Enable_3.ps1:5 char:38
+ Set-VBRJobOptions -Job $job -Options $joboptions
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-VBRJobOptions], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Veeam.Backup.PowerShell.Cmdlets.SetVBRJobOptions
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Enable Bitlooker - Powershell
Seems to work ok if I specify a job but not when using wildcard (*) for all jobs.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enable Bitlooker - Powershell
Some object of different type seems to get assigned to $Job or $JobOptions variable, try to limit the script to backup job first and see whether it works:
Thanks!
Code: Select all
foreach ($Job in Get-VBRJob | where {$_.JobType -eq "Backup"})
{
$joboptions = Get-VBRJobOptions -Job $job
$joboptions.ViSourceOptions.ExcludeSwapFile = $true
$joboptions.ViSourceOptions.DirtyBlocksNullingEnabled = $true
Set-VBRJobOptions -Job $job -Options $joboptions
}
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Enable Bitlooker - Powershell
That fixed the issue for me. Thanks.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Enable Bitlooker - Powershell
Most likely, some file or copy jobs got assigned to the $Job variable previously, those object didn't have the said property, as the result the script failed.
Glad to hear that you've fixed the issue.
Thanks!
Glad to hear that you've fixed the issue.
Thanks!
Who is online
Users browsing this forum: Bing [Bot] and 19 guests