Comprehensive data protection for all workloads
Post Reply
DrakeLennox
Novice
Posts: 7
Liked: 2 times
Joined: Sep 29, 2014 11:47 am
Full Name: Drake Lennox
Contact:

SureBackup Test Scripts

Post by DrakeLennox »

Hi,

I want to test some services and processes in my surebackup environment. I added the example script from this article as first step (http://www.veeam.com/blog/automate-reco ... ackup.html).Also i can see that the script will be executed and the result is OK "Custom script 1: name Check Service DHCP, OK".

But if i want to test a fail by setting the service from "dhcp" to "dhcp123123" in the ApplicationGroup Script Properties, the result is also a OK and the job is successful.

Code: Select all

04.03.2015 12:28:18          Application initialization
04.03.2015 12:26:18          Waiting for 120 more seconds...
04.03.2015 12:26:18          Note: operation will be continued at 04.03.2015 12:28:18
04.03.2015 12:28:18          Summary: application is initialized
04.03.2015 12:28:19          Running test scripts
04.03.2015 12:28:19          Custom script 1: name Check Service DHCP, OK
04.03.2015 12:28:19          Results: 1/1 test(s) passed, 0 failed, 0 skipped
04.03.2015 12:28:19          Summary: 100% total pass rate
Some ideas? Thank you
remko.de.koning
Enthusiast
Posts: 92
Liked: 18 times
Joined: May 21, 2014 12:15 pm
Full Name: Remko de Koning
Contact:

Re: SureBackup Test Scripts

Post by remko.de.koning » 1 person likes this post

If not mistaken the Veeam scripts just check for tcp port listing.

I found some scripts on the internet which I use now to see if a specific service is running. Would this be of help?

Batchtfile: query-service.bat

Code: Select all

REM query-service.bat
@ECHO OFF
powershell.exe -noninteractive -noprofile -command "& {C:\Scripts\query-service.ps1 %1 %2 }"
EXIT /B %errorlevel%
Powershell script: query-service.ps1

Code: Select all

#query-service.ps1
param(
[string] $ip, #IP address of checked server
[string] $service ) #Service name
$result = (get-Service -ComputerName $ip -Name $service -ErrorAction SilentlyContinue)
if($result.status -eq "Running")
{
exit
}
else
{
write-host ("Error 1, Service '" + $service + "' not running or not found.") #if service not found or not running, then echo
$host.SetShouldExit(1)
exit
}
In my application pool under scripts I have the following
Name: Query Zend Server
Path: c:\Scripts\query-service.bat
Arguments: %vm_ip% MySQL_ZendServer55

I noticed my script failed the first few times. Things to consider.
The script runs with a domain account. Make sure you have a domain controller running in your virtual lab.
On a Windows 2008 R2 machine I noticed that the virtual NIC was placed in "public" network instead of the domain network. For this network the firewall was active and hence my script could not be tested.

Hope this helps...

Remko
DrakeLennox
Novice
Posts: 7
Liked: 2 times
Joined: Sep 29, 2014 11:47 am
Full Name: Drake Lennox
Contact:

Re: SureBackup Test Scripts

Post by DrakeLennox »

Hi Remko,

thank you. I had a wrong path in the batch file :) no its working but i had also problems with get-process.

just for information:
the problem was powershell related. i used the invoke-command instead of the default routine:

$result = invoke-command -computername $ip (get-process -Name $process -ErrorAction SilentlyContinue)
veremin
Product Manager
Posts: 20405
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SureBackup Test Scripts

Post by veremin »

Invoke expressions are used mostly for PS remoting and do not seem to be necessary in your case.

Anyway, glad to hear you're up and running now.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 301 guests