Wednesday, April 3, 2013

Veeam SureBackup scripts for Exchange 2010

Veeam's SureBackup is an excellent tool to verify the viability of your backups, and is able to run test scripts against your backed up VMs. This is a test script which runs against an Exchange 2010 mailbox server and checks whether the Information Store, System Attendant, and Service Host services are running or not. Just put your relevant IP in the script.


REM Start-Sleep -s 60

# Start Exchange servers on Mailbox servers

Start-Service -InputObject $(Get-Service -Computer 192.168.0.1 -Name MSExchangeIS)
Start-Service -InputObject $(Get-Service -Computer 192.168.0.1 -Name MSExchangeSA)
Start-Service -InputObject $(Get-Service -Computer 192.168.0.1 -Name MSExchangeServiceHost)

REM Start-Sleep -s 60

# Check Exchange services Status

$ExchSvc = (get-service -ComputerName 192.168.0.1 -Name MSExchangeIS -ErrorAction SilentlyContinue)
IF($ExchSvc.status -ne "Running"){$host.SetShouldExit(1)}

$ExchSvc = (get-service -ComputerName 192.168.0.1 -Name MSExchangeSA -ErrorAction SilentlyContinue)
IF($ExchSvc.status -ne "Running"){$host.SetShouldExit(1)}

$ExchSvc = (get-service -ComputerName 192.168.0.1 -Name MSExchangeServiceHost -ErrorAction SilentlyContinue)
IF($ExchSvc.status -ne "Running"){$host.SetShouldExit(1)}

Exit



SureBackup can't run a Power Shell script directly, so you need to call the script from a batch file. In this situation the PS script is saved as exchangembx.ps1 in the root of C.


powershell.exe -noninteractive -noprofile -command "& {C:\exchangembx.ps1}"
EXIT /B %errorlevel%


No comments:

Post a Comment