Hi all,
As a service provider we have a lot of veeam backup and replication servers to manage. We would like to be able to restart them on specific service windows.
I´m looking for a powershell script that can restart a veeam backup and replication server (windows server), incase there are no activity going on in the server. With activities I mean all activities.
We have agents in the so we can let the agent manage the script.
Anyone who know how to do this in a safe manner?
Many thanks!
Tomas
-
- Service Provider
- Posts: 5
- Liked: 3 times
- Joined: Oct 01, 2019 6:15 pm
- Full Name: Tomas Ståhl
- Contact:
-
- Veeam Software
- Posts: 2736
- Liked: 629 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Restart of BoR Servers with no running activities
Hi Tomas,
Just to confirm, basically you want a script that:
1. Confirms no jobs are active on the VBR server
2. Initiate a Windows Shutdown
Am I correct? Are these the Provider VBR servers or tenant controlled VBR servers?
Depending on the VBR server, a few ways to do this, I think easiest is just to check for active job sessions:
Get-VBRLicenseAutoUpdateStatus | Out-Null #Load DLLs for .NET Reflection
$runningBackupSess = [Veeam.Backup.Core.CBackupSession]::GetRunning()
$runningRestoreSess = [Veeam.Backup.Core.CRestoreSession]::GetRunning()
Check the results of either, and if there are running backup or restore sessions, Start-Sleep for some period of time (5-10 minutes), and check again.
Just to confirm, basically you want a script that:
1. Confirms no jobs are active on the VBR server
2. Initiate a Windows Shutdown
Am I correct? Are these the Provider VBR servers or tenant controlled VBR servers?
Depending on the VBR server, a few ways to do this, I think easiest is just to check for active job sessions:
Get-VBRLicenseAutoUpdateStatus | Out-Null #Load DLLs for .NET Reflection
$runningBackupSess = [Veeam.Backup.Core.CBackupSession]::GetRunning()
$runningRestoreSess = [Veeam.Backup.Core.CRestoreSession]::GetRunning()
Check the results of either, and if there are running backup or restore sessions, Start-Sleep for some period of time (5-10 minutes), and check again.
David Domask | Product Management: Principal Analyst
-
- Service Provider
- Posts: 5
- Liked: 3 times
- Joined: Oct 01, 2019 6:15 pm
- Full Name: Tomas Ståhl
- Contact:
Re: Restart of BoR Servers with no running activities
Thanks for your reply David.
Yes, that´s right. I want the script to:
1. Confirms no jobs are active on the VBR server ((backup, backup copy, DB-backup (SQL ect) restore))
2. Initiate a Windows Shutdown
So I want to make sure that no backup, backup copy, SQL or Oracle backup or restore are running.
If not reboot the windows server.
Does the script provided cover all these?
Our frontend physical VBR-servers using local block storage inside the OS and SOBR.
Do you know how the reboot and sleep (if running looks like as well?
Kind regards
Tomas
Yes, that´s right. I want the script to:
1. Confirms no jobs are active on the VBR server ((backup, backup copy, DB-backup (SQL ect) restore))
2. Initiate a Windows Shutdown
So I want to make sure that no backup, backup copy, SQL or Oracle backup or restore are running.
If not reboot the windows server.
Does the script provided cover all these?
Our frontend physical VBR-servers using local block storage inside the OS and SOBR.
Do you know how the reboot and sleep (if running looks like as well?
Kind regards
Tomas
-
- Veeam Software
- Posts: 2736
- Liked: 629 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Restart of BoR Servers with no running activities
Hi Tomas,
Correct,these methods are a bit of a cheat, but they're a fast way to look for activity. Please do note however that some background service jobs like Host Discovery or Background Retention may be running. The discovery jobs can probably be ignored, but anything like Background Retention or Checkpoint Removal I would wait to finish before rebooting.
> reboot and sleep via powershell
Reboot: https://learn.microsoft.com/en-us/power ... rshell-5.1
Sleep is a bit tricky and I would avoid it from automation -- a lot of the endpoints I've seen that are called sleep actually hibernate the machine, it's not well documented on how to safely (and properly) sleep a machine from Powershell. I've seem some code that calls Windows Forms, but never tried it.
Correct,these methods are a bit of a cheat, but they're a fast way to look for activity. Please do note however that some background service jobs like Host Discovery or Background Retention may be running. The discovery jobs can probably be ignored, but anything like Background Retention or Checkpoint Removal I would wait to finish before rebooting.
> reboot and sleep via powershell
Reboot: https://learn.microsoft.com/en-us/power ... rshell-5.1
Sleep is a bit tricky and I would avoid it from automation -- a lot of the endpoints I've seen that are called sleep actually hibernate the machine, it's not well documented on how to safely (and properly) sleep a machine from Powershell. I've seem some code that calls Windows Forms, but never tried it.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 12 guests