1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| function ServerOnline {
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="Enter the Computer name or IP address")]
[Alias('Hostname','Computer')]
[string[]]$server
)
#add the Xen App Commands powershell Snapin
if (-not(Get-PSSnapin "Citrix.Xenapp.Commands" -ErrorAction Silentlycontinue)) {
try {
Add-PSSnapin "Citrix.Xenapp.Commands" -ErrorAction Stop
} catch {
Write-Warning "The Citrix Xen App Commands snapin failed to install. Check that this server has the snapin installed and try again. `nError Message: $_"
}
}
try {
$serverload = get-xaserverload -ServerName $server -ErrorAction SilentlyContinue
if ($serverload) {
$true
}
} catch {
Write-Warning "Could not retreive serverload for $server. `nError Message: $_"
}
} |
function ServerOnline {
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="Enter the Computer name or IP address")]
[Alias('Hostname','Computer')]
[string[]]$server
)
#add the Xen App Commands powershell Snapin
if (-not(Get-PSSnapin "Citrix.Xenapp.Commands" -ErrorAction Silentlycontinue)) {
try {
Add-PSSnapin "Citrix.Xenapp.Commands" -ErrorAction Stop
} catch {
Write-Warning "The Citrix Xen App Commands snapin failed to install. Check that this server has the snapin installed and try again. `nError Message: $_"
}
}
try {
$serverload = get-xaserverload -ServerName $server -ErrorAction SilentlyContinue
if ($serverload) {
$true
}
} catch {
Write-Warning "Could not retreive serverload for $server. `nError Message: $_"
}
}