-
- Lurker
- Posts: 1
- Liked: never
- Joined: Mar 15, 2019 12:29 pm
- Contact:
Shutdown Script
Hello everybody,
i have this script to check if a job is running on Veeam Backup and Replication.:
$jobsworking = @(Get-VBRJob| Where {$_.GetLastState() -eq "Working"} )
if ($jobsworking.Count -gt 0) {
write-host "Jobs are still working"
} else {
write-host "Nothing is working, let's shutdown machines"
}
But it does not work for Veeam Backup for Microsoft Office 365.
What can i do?
Best Regards
i have this script to check if a job is running on Veeam Backup and Replication.:
$jobsworking = @(Get-VBRJob| Where {$_.GetLastState() -eq "Working"} )
if ($jobsworking.Count -gt 0) {
write-host "Jobs are still working"
} else {
write-host "Nothing is working, let's shutdown machines"
}
But it does not work for Veeam Backup for Microsoft Office 365.
What can i do?
Best Regards
-
- Veeam Software
- Posts: 3195
- Liked: 774 times
- Joined: Oct 21, 2011 11:22 am
- Full Name: Polina Vasileva
- Contact:
Re: Shutdown Script
Hi Jharvick,
First of all, VBO has its own PowerShell reference with its own specific cmdlets. Thus, instead of the 'Get-VBRJob', you need to use the 'Get-VBOJob' command; and to the best of my knowledge, it's only possible to get the jobs' LastRun or NextRun info. However, I'll double check on this and get back to you if there're any options to get the job's running state.
First of all, VBO has its own PowerShell reference with its own specific cmdlets. Thus, instead of the 'Get-VBRJob', you need to use the 'Get-VBOJob' command; and to the best of my knowledge, it's only possible to get the jobs' LastRun or NextRun info. However, I'll double check on this and get back to you if there're any options to get the job's running state.
-
- Product Manager
- Posts: 5797
- Liked: 1215 times
- Joined: Jul 15, 2013 11:09 am
- Full Name: Niels Engelen
- Contact:
Re: Shutdown Script
Keep in mind, VBO Archive service will wake up your computer. What would be the purpose of shutting down the computer?
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
GitHub: https://github.com/nielsengelen
-
- Veeam Software
- Posts: 3195
- Liked: 774 times
- Joined: Oct 21, 2011 11:22 am
- Full Name: Polina Vasileva
- Contact:
Re: Shutdown Script
Jharvick,
Upon a double check with the QC, in VBO, LastStatus parameter will give you the job's running/not running state.
Upon a double check with the QC, in VBO, LastStatus parameter will give you the job's running/not running state.
-
- Influencer
- Posts: 13
- Liked: 2 times
- Joined: Sep 04, 2015 5:56 pm
- Full Name: Gerald
- Contact:
Re: Shutdown Script
Here is a finished working Powershell script to do what was asked for, I had the same wish as the original poster here.
Code: Select all
$jobsfinished = $false
while ($jobsfinished -eq $false)
{
$jobsworkingcount = @(Get-VBOJob | Where LastStatus -eq 'Running').Count
if ($jobsworkingcount -eq 0)
{
write-host "All jobs have finished!"
$jobsfinished = $true
}
else
{
write-host "$jobsworkingcount jobs are still working, sleeping for 60s..."
Start-Sleep -s 60
}
}
write-host "Nothing is working, let's shutdown machine in 120 seconds..."
Start-Sleep -s 120
Stop-Computer -Force
Who is online
Users browsing this forum: No registered users and 14 guests