<< Back to Script Library

Test App-V Publishing Servers

Tests if the App-V publishing servers are reachable from the client computer
Version: 1.0.1
Created: 2015-04-10
Modified: 2015-04-10
Creator: at-nick
Downloads: 69
Tags: App-V
The Script Copy Script Copied to clipboard
Function Test-AppVPublishingServer
{
    $Publishing_Servers = Get-AppvPublishingServer
    foreach ($Publishing_Server in $Publishing_Servers)
    {
        if (Test-Connection -ComputerName $Publishing_Server.Name -Count 2 -Quiet)
        {
            $status = "Reachable"
        }
        else
        {
            $status = "Un-Reachable"
        }
        $Publishing_Server | Add-Member -MemberType NoteProperty -Name "Status" -Value $status
    }
    $Publishing_Servers | sort -Property Name -Descending | Select Name,URL,Status
}

$ErrorActionPreference = "Stop"

If ( (Get-Module -Name AppvClient -ErrorAction SilentlyContinue) -eq $null )
{
        # using try/catch can stop the script completely if needed with "Exit with error" - 'Exit 1' (or some other non-zero exit code)
        # and avoid a long string of errors because the first statement was not successful.
        Try {
                Import-Module AppvClient
        } Catch {
                Write-Host "There is a problem loading the Powershell module. It is not possible to continue."
                Exit 1
        }
}

Test-AppVPublishingServer