init veeam service scripts
parent
561009e718
commit
d64f418107
|
|
@ -0,0 +1,63 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Starts all Veeam Backup & Replication related services on the local machine.
|
||||
.DESCRIPTION
|
||||
This script identifies and starts all Windows services related to Veeam Backup & Replication.
|
||||
It requires administrative privileges to run.
|
||||
.NOTES
|
||||
File Name : Start-VeeamServices.ps1
|
||||
Prerequisite : PowerShell 5.1 or later, Run as Administrator
|
||||
Copyright : © 2023
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
Write-Host "Starting Veeam-related services..." -ForegroundColor Cyan
|
||||
|
||||
# Get all services with "Veeam" in their display name
|
||||
$veeamServices = Get-Service | Where-Object { $_.DisplayName -like "*Veeam*" -or $_.Name -like "Veeam*" }
|
||||
|
||||
if (-not $veeamServices) {
|
||||
Write-Host "No Veeam services found." -ForegroundColor Yellow
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "Found the following Veeam services:" -ForegroundColor Green
|
||||
$veeamServices | Format-Table -AutoSize -Property DisplayName, Status
|
||||
|
||||
# Start each Veeam service
|
||||
foreach ($service in $veeamServices) {
|
||||
try {
|
||||
if ($service.Status -ne 'Running') {
|
||||
Write-Host "Starting service: $($service.DisplayName)..." -NoNewline
|
||||
Start-Service -Name $service.Name -ErrorAction Stop
|
||||
Write-Host " [Started]" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Service $($service.DisplayName) is already running." -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host " [Failed to start]" -ForegroundColor Red
|
||||
Write-Host "Error: $_" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nAll Veeam services have been processed." -ForegroundColor Cyan
|
||||
|
||||
# Verify all services are running
|
||||
$stoppedServices = $veeamServices | Where-Object { $_.Status -ne 'Running' }
|
||||
if ($stoppedServices) {
|
||||
Write-Host "Warning: The following Veeam services failed to start:" -ForegroundColor Yellow
|
||||
$stoppedServices | Format-Table -AutoSize -Property DisplayName, Status
|
||||
} else {
|
||||
Write-Host "All Veeam services are now running." -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Additional check for services that might be in 'StartPending' state
|
||||
Write-Host "`nChecking service status after startup attempt..." -ForegroundColor Cyan
|
||||
Start-Sleep -Seconds 5
|
||||
$veeamServices | ForEach-Object {
|
||||
$service = $_
|
||||
$refreshed = Get-Service -Name $service.Name
|
||||
Write-Host "$($refreshed.DisplayName) is $($refreshed.Status)" -ForegroundColor $(if ($refreshed.Status -eq 'Running') { 'Green' } else { 'Yellow' })
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Stops all Veeam Backup & Replication related services on the local machine.
|
||||
.DESCRIPTION
|
||||
This script identifies and stops all Windows services related to Veeam Backup & Replication.
|
||||
It requires administrative privileges to run.
|
||||
.NOTES
|
||||
File Name : Stop-VeeamServices.ps1
|
||||
Prerequisite : PowerShell 5.1 or later, Run as Administrator
|
||||
Copyright : © 2023
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
Write-Host "Stopping Veeam-related services..." -ForegroundColor Cyan
|
||||
|
||||
# Get all services with "Veeam" in their display name
|
||||
$veeamServices = Get-Service | Where-Object { $_.DisplayName -like "*Veeam*" -or $_.Name -like "Veeam*" }
|
||||
|
||||
if (-not $veeamServices) {
|
||||
Write-Host "No Veeam services found." -ForegroundColor Yellow
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "Found the following Veeam services:" -ForegroundColor Green
|
||||
$veeamServices | Format-Table -AutoSize -Property DisplayName, Status
|
||||
|
||||
# Stop each Veeam service
|
||||
foreach ($service in $veeamServices) {
|
||||
try {
|
||||
if ($service.Status -eq 'Running') {
|
||||
Write-Host "Stopping service: $($service.DisplayName)..." -NoNewline
|
||||
Stop-Service -Name $service.Name -Force -ErrorAction Stop
|
||||
Write-Host " [Stopped]" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Service $($service.DisplayName) is already stopped." -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host " [Failed to stop]" -ForegroundColor Red
|
||||
Write-Host "Error: $_" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nAll Veeam services have been processed." -ForegroundColor Cyan
|
||||
|
||||
# Verify all services are stopped
|
||||
$runningServices = $veeamServices | Where-Object { $_.Status -eq 'Running' }
|
||||
if ($runningServices) {
|
||||
Write-Host "Warning: The following Veeam services are still running:" -ForegroundColor Yellow
|
||||
$runningServices | Format-Table -AutoSize -Property DisplayName, Status
|
||||
} else {
|
||||
Write-Host "All Veeam services have been successfully stopped." -ForegroundColor Green
|
||||
}
|
||||
Loading…
Reference in New Issue