Configure vRanger Date Format to use system locale

The date format within the vRanger Backup & Replication product, does not use the system locale and by default is configured to use ‘en-US’ .

In order for the date format to use the system locale, you will need to remove the default ‘ForceCulture’ value in the ‘C:\Program Files\Dell\vRanger\Vizioncore.vRanger.Client.Shell.exe.config’ file.

The default value is as below:

 <add key="ForceCulture" value="en-US"/></appSettings>

By removing the value, and restarting the Dell vRanger service, this will now use the system locale.

 <add key="ForceCulture" value=""/></appSettings>

Perform Analysis Services database backups using Powershell

I was recently looking into performing SQL Server Analysis Services database backups using Powershell within an automated task, with the following requirements: 

  • Perform a backup of all databases for running instances of Analysis Services.
  • If the target location does not exist, create the directory.

Firstly we need to load the Microsoft SQL Server Analysis Services binaries in order to connect to the instance and invoke actions. 

Capture1

I will also retrieve the computername and store this in a variable to use later in the server connection properties. 

Capture2

Using the Get-Service cmdlet, I will return all running instances ¬†by filtering the output to include where the service name is like *MSOLAP$* and the status is ‘Running’.

Capture3

Once, I have returned the running instances of Analysis Services I will loop through each one to firstly obtain the instance name by manipulating the service name returned in my collection and then connecting to the instance using the binaries previously loaded into the powershell session. 

Capture4

Now, I will be required to loop through each database within the instance and to check if the target location exists and if not create the folder. 

Capture5

Finally, we will create a backup of the database to which I will append the date string ddMMyyyy_HHmmss to the the filename. 

Capture6

The above can be automated by creating a task in Task Scheduler and configuring a trigger to perform the action of invoking the powershell script. 

The powershell script can be downloaded from: 

 https://app.box.com/s/x000axp5qu37y3uzs1ue

Report Job Status from vRanger to Nagios

I have been recently creating a number of external scripts within Nagios to bring together a number of services to be monitored. I am now looking at reporting the job status from vRanger backup jobs to Nagios based on the following criteria:

  • Report the last completed run of a backup job.
  • Report the job status and information to Nagios, where successful jobs are reported with the OK status and failed jobs with Critical status.

I will be able to do this by calling a number of cmdlets from the vRanger API Powershell snap-in, which by default is installed with vRanger.

Also the script will be required to return the status of multiple backup jobs, I do not want to create multiple scripts as well as multiple services within Nagios. Therefore, the script defined a mandatory parameter for the backup job name, which is called with the JobName argument.

Param ([parameter(Mandatory = $true)][string] $JobName)

As mentioned, previously we will be using the vRanger API Powershell snap-in to query the backup job status, so we will need to import the snap-ins to the current session:

if (-not (Get-PSSnapin vRanger.API.PowerShell -ErrorAction SilentlyContinue)) 
{ 
Add-PSSnapin vRanger.API.PowerShell > $null
}

Now, we need to filter the backup job name from the job template with the parameter specified.

$Template = Get-JobTemplate | Where-Object {$_.JobName -eq $JobName}

Now that we have the job name we will return the status from the Get-Job cmdlet by comparing the ParentJobTemplateId and the job template TemplateVersionId to return matching jobs where the status is completed and also return the most recent job history.

$Job = Get-Job | Where-Object {$_.ParentJobTemplateId -eq $Template.TemplateVersionID -and $_.JobState -eq "Completed"} | Select -Last 1

Now that we return the job status, we will need to generate return codes for the service status. The criteria as mentioned above is for jobs with the status success to be returned with the service status OK (0) and for jobs not reported as successful for this to be critical (2).

If ($Job.JobStatus -eq "Success")
{ 
$returncode = 0
} 

Else 
{ 
$returncode = 2
}

Finally I want to output the service status information for the backup job being monitored and exit the session returning the error code:

"" + $Job.JobState + " with " + $Job.JobStatus + " on " + $Job.CompletedOn
exit $returncode

One issue I found was that the vRanger API Powershell snap-in is only available in a 32-bit version and therefore requires the snap-in to be imported to the 32-bit version of Windows Powershell. Therefore, this requires the external script to call, the 32-bit executable from the check command:

check_vrangerbackupstatus= cmd /c echo scripts\Get-vRangerBackupStatus.ps1 -JobName "$ARG1$"; exit($lastexitcode) | %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -command -

While the script was created to be executed as an external script within Nagios, this can be run standalone from Windows Powershell as below.

%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -command ./Get-vRangerBackupStatus.ps1 -JobName <Job Name>

If your are looking to add external scripts to Nagios such as this one see the below link for more information;

https://deangrant.wordpress.com/2013/09/12/creating-and-running-external-scripts-within-nagios-xi/

The full Windows Powershell script can be downloaded from the below link:

https://app.box.com/s/3sgeu21nxxvv1oi02zte

Register for free Veeam Backup & Replication NFR licence as a VCP

I currently do not use Veeam Backup & Replication currently in a production environment, I have previously evaluated the current release (as well as previous iterations) and have been impressed with features such as Instant VM recovery and the use of the vPower NFS server, advanced replication features which include  real failback and the Sure Backup feature. 

One of the main disadvantages I found when using the product was that the new version introduced a distributed architecture which is true with the use of backup proxy servers. However I found that the inability to schedule more than one VM in a backup job at a time required more management in larger environments. 

As a VCP I recently found out that I was entitled to a NFR licence for evaluation and demonstration purposes; this is available to all vExperts, VCPs and VCIs for free and covers a two-socket licence; the URL to register for the free NFR licence: 

http://www.veeam.com/nfr/free-nfr-license

Automate systemstate backup using Windows Server Backup feature

I was recently tasked with automating the backup of the systemstate of  several Windows 2008 R2 domain controllers using the Windows Server Backup feature.

Firstly, the Windows Server Backup feature is required to be installed;

1) Run Windows Powershell

2) From the command line type the below to import the Server Manager module into the current session;

Import-Module ServerManager

3) From the command line type the below to install the Windows Server Backup Features

Add-WindowsFeature Backup-Features -IncludeAllSubFeature

The backup of the systemstate can be invoked manually from the command line (with elevated privelages) as follows;

wbadmin start systemstatebackup -BackupTarget:<backup volume>

However, this process was then required to be automated, one of the limitations of the Windows Server Backup feature is that the backup target is required to be a local volume, the automation process requires the backup file to be archived to a destination folder based on the geographical location of the domain controller and retain the backup file for a period of seven days.

So firstly, the script will need to set the destination location for the backup file to be created, the requirement is based on geographical location, this was relatively easy for me to obtain due to the server naming scheme uses the fourth character to reference the geographical location so the substring method will allow me to set the destination folder,also  in this step any previous system state backups are deleted from the local volume;

# Retrieves the computername of the local host.
$Computer = gc env:computername

# Deletes previous system state backup.
Get-Item (“B:\WindowsImageBackup\” + $Computer + “\Backup*”) | Remove-Item

# Extracts the fourth character of the computername to determine the geograhpical location. 

$Location = $Computer.Substring(3,1)

# Sets the destination location to archive the systemstate backup based on the geographical location of the server
If ($Location -eq “x”){$Destination = “\\<server>\<folder>\SystemState\” + $Computer + “\”}
ElseIf ($Location -eq “y”) {$Destination = “\\<server>\<folder>\SystemState\” + $Computer + “\”}

Now we will need to invoke the systemstate backup using the following command;

# Performs system state backup in quiet mode.
wbadmin start systemstatebackup -BackupTarget:<backup volume> -quiet

Once the systemstate backup is complete we will now need to archive the local backup file to the destination folder which is set based on the geographical location of the domain controller;

# Copies the backup folder to destination location specified to archvice the systemstate backup.
$Source = Get-Item (“B:\WindowsImageBackup\” + $Computer + “\Backup*”)
Copy-Item $Source.fullname -Destination ($Destination + “\” + $Source.name) -Recurse

Finally we need to apply the retention period on the destination folder, where in this case is 7 days

#Deletes backup folder items older than 7 days.
Get-ChildItem $Destination | where {$_.Lastwritetime -lt (date).adddays(-7)} | Remove-Item

The powershell script may then be invoked from Task Scheduler to automate the process.

The powershell script  may be downloaded from the below:

http://www.box.com/embed/tzdznohy3px1t63.swf