Free Consultation

Powershell Script to get SQL Mirroring Configuration for XenApp 6.x

I Wrote this little script for XenApp 6.x last week. It will connect to all servers in your XenApp 6.x farm and find out whether the DSN is configured for SQL mirroring.

[download id=”1613″]

[download id=”1620″]

[download id=”1623″]

[download id=”1617″]

<# .SYNOPSIS Gathers information regarding XenApp 6.x SQL mirroring configuration .DESCRIPTION Connects to each XenApp server in the farm and checks whether it has been configured for SQL mirroring. .PARAMETER AdminAddress Name of a controller in the farm .PARAMETER Path Path where report will be saved .EXAMPLE PS C:Scripts > .XenApp_SQL_Mirroring_v1.0.ps1 -AdminAddress LONALVCXA001 -path C:Reports

Script will connect to controller LONALVCXA001 and save the report to C:Reports
.INPUTS
None. You cannot pipe objects to this script.
.OUTPUTS
No objects are output from this script. This script creates a its own logs files
.LINK

.NOTES
NAME: XenApp_SQL_Mirroring.ps1
VERSION: 1.00
AUTHOR: Shaun Ritchie

The script must be executed using an account which has permissions to query the XenApp farm and also be able to remotely connect to the XenApp servers C$
#>

[CmdletBinding(SupportsShouldProcess = $false, ConfirmImpact = “None”, DefaultParameterSetName = “”) ]

Param ([parameter(Mandatory=$true)]
[Alias(“AA”)]
[ValidateNotNullOrEmpty()]
[String]$AdminAdress=””,

[parameter(Mandatory=$true)]
[Alias(“PA”)]
[ValidateNotNullOrEmpty()]
[String]$Path=””)

Add-PSSnapin Citrix.*
[array]$servers = @()
$servers = Get-XAServer -ComputerName $AdminAdress
$servers | Add-Member -MemberType NoteProperty -Name mf20 -Value “”
foreach ($server in $servers)
{
If (!(Test-Connection -ComputerName $server.ServerName -Quiet))
{
$server.mf20 = “Not contactable”
}
Else
{
$mf20 = (Get-Content “\$serverc$Program Files (x86)CitrixIndependent Management Architecturemf20.dsn”)[6]
$server.mf20 = $mf20
}
}

$servers | Select-Object ServerName,mf20 | Sort-Object ServerName | Export-Csv “$PathXenApp_SQL_Mirroring.csv”