PowerShell script exchange
Post Reply
filipsmeets
Enthusiast
Posts: 37
Liked: 3 times
Joined: Jun 26, 2019 3:28 pm
Full Name: Filip Smeets
Contact:

Creating Protection Groups

Post by filipsmeets »

Hi

I'm trying to script the creation of Protection Groups based on Clusters found in AD.

#Find clusters.
$AD = Get-VBRADDomain -ServerName $domainc -Credentials $credentials
$root = Find-VBRADEntity -Domain $AD
$clustersMX = Find-VBRADEntity -Domain $AD -Root $root -Recurse -Type Cluster |Where-Object{$_.Name -like ($site + "*MX*")}

#Create containers to be used in the Protection groups.
$scopeMX = New-VBRADContainer -Domain $AD -Entity $clustersMX -MasterCredentials $credentials -ExcludeVMs $false

When creating the containers, I would like to set the ExcludeVMs to $false but this is not possible.

New-VBRADContainer : A positional parameter cannot be found that accepts argument 'False'.
At line:1 char:12
+ $scopeMX = New-VBRADContainer -Domain $AD -Entity $clustersMX -Master ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-VBRADContainer], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Veeam.Backup.PowerShell.Cmdlets.NewVBRADContainer

#Create Protection Group
Add-VBRProtectionGroup -Name $clustersMX.Name.Substring(0,14) -Container $scopeMX -Description $descrMX -DeploymentOptions $options -AdvancedOptions $advoptions -NotificationOptions $notify

The ExcludeVMs property is ReadOnly:

>$scopeMX.ExcludeVMs = $false
'ExcludeVMs' is a ReadOnly property.
At line:1 char:1
+ $scopeMX.ExcludeVMs = $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
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: Creating Protection Groups

Post by jhoughes » 2 people like this post

You need to set the Exclude VMs parameter with a colon like this:

Code: Select all

$scopeMX = New-VBRADContainer -Domain $AD -Entity $clustersMX -MasterCredentials $credentials -ExcludeVMs:$false
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
filipsmeets
Enthusiast
Posts: 37
Liked: 3 times
Joined: Jun 26, 2019 3:28 pm
Full Name: Filip Smeets
Contact:

Re: Creating Protection Groups

Post by filipsmeets »

It worked. Thx!
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests