This repository has been archived by the owner on Oct 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
CAS002.ps1
50 lines (43 loc) · 1.49 KB
/
CAS002.ps1
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#requires -Modules ExchangeAnalyzer
#This function tests each CAS URL to determine whether it contains a server FQDN
Function Run-CAS002()
{
[CmdletBinding()]
param()
$TestID = "CAS002"
Write-Verbose "----- Starting test $TestID"
$PassedList = @()
$FailedList = @()
$ErrorList = @()
foreach ($CAS in $ClientAccessServers)
{
$HasUrlsWithFQDN = $false
$serverFQDN = $CAS.Fqdn.ToLower()
$serverURLs = @($CASURLs | Where {$_.Name -ieq $CAS.Name})
$propertyNames = @($serverURLs | Get-Member -Type NoteProperty | Where {$_.Name -ne "Name"} | Select Name)
foreach ($name in $propertyNames)
{
Write-Verbose "Checking URL $($serverURLs."$($name.name)")"
if ($serverURLs."$($name.name)" -icontains $serverFQDN)
{
$HasUrlsWithFQDN = $true
}
}
if ($HasUrlsWithFQDN)
{
$FailedList += $($CAS.Name)
}
else
{
$PassedList += $($CAS.Name)
}
}
$ReportObj = Get-TestResultObject -ExchangeAnalyzerTests $ExchangeAnalyzerTests `
-TestId $TestID `
-PassedList $PassedList `
-FailedList $FailedList `
-ErrorList $ErrorList `
-Verbose:($PSBoundParameters['Verbose'] -eq $true)
return $ReportObj
}
Run-CAS002