PowerShell script exchange
Post Reply
snzhang2
Influencer
Posts: 22
Liked: 1 time
Joined: Oct 12, 2016 3:17 pm
Full Name: Nan Zhang
Contact:

Two *-VBRViReplicaJob cmdlets -suffix issue

Post by snzhang2 »

Hi,

I want to create a Replication job that has the suffix set to blank. The two cmdlet *-VBRViReplicaJob (Add- and Set-) doesn't accept empty string or null argument for the -suffix argument. But this is exactly what I want to do. Is there work-around this? This can be done through the GUI, so why put this restriction in the cmdlets?

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

Re: Two *-VBRViReplicaJob cmdlets -suffix issue

Post by veremin »

Have you tried to input space between quotes? I think this way a blank suffix will be created:

Code: Select all

asnp veeampssnapin
$Job = Get-VBRJob -name "Name of your replication job"
Set-VBRViReplicaJob -Job $Job -Suffix " "
Thanks.
snzhang2
Influencer
Posts: 22
Liked: 1 time
Joined: Oct 12, 2016 3:17 pm
Full Name: Nan Zhang
Contact:

Re: Two *-VBRViReplicaJob cmdlets -suffix issue

Post by snzhang2 »

Thanks! The suggestion worked. And thanks for the code.

It is not intuitive. I am wondering if you can pass this quirk to writers of cmdlets to remove that restriction from the -suffix parameter in future releases.
veremin
Product Manager
Posts: 20282
Liked: 2257 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Two *-VBRViReplicaJob cmdlets -suffix issue

Post by veremin »

The information has been provided to dev team. For now, kindly, leverage the proposed workaround. Thanks.
GabesVirtualWorld
Expert
Posts: 244
Liked: 38 times
Joined: Jun 15, 2009 10:49 am
Full Name: Gabrie van Zanten
Contact:

[MERGED] Create replica job with empty Suffix

Post by GabesVirtualWorld »

Hi
Trying to create replica jobs between datacenters, but in the new datacenter I don't want any suffix on the VM. I can set this through the GUI to a blank value, but the Powershell command doesn't accept the -Suffix value to be an empty string.

Anyway to fix this?

Gabrie
tsightler
VP, Product Management
Posts: 6011
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Create replica job with empty Suffix

Post by tsightler »

You can manually update the job settings using Set-VBRJobOptions immediately after creating the new job. Crude example:

Code: Select all

$newrepljob = Find-VBRViEntity -Name "dc01" | Add-VBRViReplicaJob -Name "DC Replication Job" -Server $server -Datastore $datastore -ResourcePool $resourcepool -Folder $folder -Description "DC server replication"
$newrepljob.ViReplicaTargetOptions.ReplicaNameSuffix = $null
Set-VBRJobOptions -Job $newrepljob -Options $newrepljob.Options
veremin
Product Manager
Posts: 20282
Liked: 2257 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Two *-VBRViReplicaJob cmdlets -suffix issue

Post by veremin »

but the Powershell command doesn't accept the -Suffix value to be an empty string.
Setting a space between two quotes should be a way to go. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests