PowerShell script exchange
Post Reply
Leo0601
Enthusiast
Posts: 88
Liked: 8 times
Joined: Oct 13, 2020 1:40 pm
Full Name: Leo
Contact:

Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by Leo0601 »

Hi Experts,

I am creating an application group for surebackup job via PowerShell. Its creating successfully.

By default, "Keep the application group running after the job completes" was selected. I wanted to uncheck the option via powershell.

This option enables performing additional manual verification or user-directed application item recovery for virtual machines in this application group.

Could someone please let me know how to uncheck the respected option?

I am looking forward to hearing from you.

Regards
Leo
Mildur
Product Manager
Posts: 9777
Liked: 2582 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by Mildur » 1 person likes this post

Hi Leo

Have you tried?

Code: Select all

$job = Get-VBRSureBackupJob -Name "SureBackup Job"
Set-VBRSureBackupJob -Job $job -KeepApplicationGroupRunning $False
Best,
Fabian
Product Management Analyst @ Veeam Software
Leo0601
Enthusiast
Posts: 88
Liked: 8 times
Joined: Oct 13, 2020 1:40 pm
Full Name: Leo
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by Leo0601 »

@Mildur

Hi Mildur,

Thanks much for the reply.

I have added your code to my script end .
I am getting an error like Set-VBRSureBackupJob : A positional parameter cannot bind that accepts argument 'False'.


Guess I am doing something. Could you please let me know?

I am waiting for your reply.

Regards
Leo

Code: Select all

$jobname = $x.JobName
        if ($jobname.Contains("Production_"+$app) -or $jobname.Contains("Test_"+$app)) {
            Write-host "Creating Job for Jobname:" $jobname
            $backup = Get-VBRBackup -name $jobname
            #$rp = Get-VBRRestorePoint -Backup $backup | Sort-Object -Property CreationTime -Descending | Select -First 1 #get newest restore point for machine
            
            $vmNames = Get-VBRRestorePoint -Backup $backup | Select-Object -ExpandProperty VMName | Select-Object -Unique
            
            $vmlist = @()
            $surebacklist = @()
            Foreach ($vm in $vmNames) {
                $rp = Get-VBRRestorePoint -Backup $backup -Name $vm | Sort-Object -Property CreationTime -Descending | Select -First 1 #get newest restore point for machin
                $surebacklist += New-VBRSureBackupVM -RestorePoint $rp
            }
            
            #$newSbVm = New-VBRSureBackupVM -RestorePoint $rp
    Write-host "Creating Application Group. Name:" $jobname
    $appGroup = Add-VBRApplicationGroup -Name $jobname -VM $surebacklist
    $surebackupjobname = $jobname+"_Surebackup"
    Write-host "Creating Sure Backup Job. Name:" $surebackupjobname
    $surebackupjob = Add-VBRSureBackupJob -ApplicationGroup $appGroup -VirtualLab $vlab -Name $surebackupjobname
    Set-VBRSureBackupJob -job $surebackupjob -KeepApplicationGroupRunning $False
benthomas
Veeam Vanguard
Posts: 53
Liked: 19 times
Joined: Apr 22, 2013 2:29 am
Full Name: Ben Thomas
Location: New Zealand
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by benthomas » 1 person likes this post

Try this instead

Code: Select all

 Set-VBRSureBackupJob -job $surebackupjob -KeepApplicationGroupRunning:$False
Ben Thomas | Solutions Advisor | Veeam Vanguard 2023 | VMCE2022 | Microsoft MVP 2018-2023 | BCThomas.com
Leo0601
Enthusiast
Posts: 88
Liked: 8 times
Joined: Oct 13, 2020 1:40 pm
Full Name: Leo
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by Leo0601 »

@benthomas

Hi Ben,

Thanks much for the reply. Your code is working fine. Given thumbs up for your reply.

Now Its unchecking the "Keep the application group running after the job completes" option.

But still our surebackup job is failing. We suspected it was because of those settings. Still its failing even after unchecked.

Anything else I have to make the change in my code, could you please let me know?

It would be great if you help me to fix it.

Thanks in advance.
jhoughes
Veeam Vanguard
Posts: 282
Liked: 113 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by jhoughes »

What is the actual error message? No one can really assist without that detail.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
Leo0601
Enthusiast
Posts: 88
Liked: 8 times
Joined: Oct 13, 2020 1:40 pm
Full Name: Leo
Contact:

Re: Have to uncheck "Keep the application group running after the job completes" while creating app group via Powershell

Post by Leo0601 »

@jhoughes

Hi Houghes

Thanks for the reply. Yeah, sure, I will share the error message.

I checked the report of the sureback job. I was getting the below 2 errors.
* Disabling firewall
* Operation is not valid due to current state of the object
Firewall was enabled in the destination server, which I am trying to take the surebackup job

Regards
Leo
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests