forked from tomtorggler/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExVirtualDir.ps1
57 lines (46 loc) · 1.7 KB
/
ExVirtualDir.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
51
52
53
54
55
56
57
function Get-VirtualDir {
param(
$ExchangeServer,
[switch]$AdProp
)
foreach($server in $ExchangeServer) {
$param = @{
'Server' = $server;
'ADPropertiesOnly' = $true;
'ErrorAction' = 'Stop';
}
try {
$owa = Get-OwaVirtualDirectory @param
$ews = Get-WebServicesVirtualDirectory @param
$oab = Get-OabVirtualDirectory @param
$mapi = Get-MapiVirtualDirectory @param
$autodiscover = Get-ClientAccessService -Identity $server
$oa = Get-OutlookAnywhere @param
$eas = Get-ActiveSyncVirtualDirectory @param
$out = @{
'internal' = @{
'Server' = $server
'OWA' = $owa.InternalUrl
'EWS' = $ews.InternalUrl
'OAB' = $oab.InternalUrl
'EAS' = $eas.InternalUrl
'Mapi' = $mapi.InternalUrl
'OutlookAnywhere' = $oa.InternalHostname
'Autodiscover' = $autodiscover.AutoDiscoverServiceInternalUri
};
'external' = @{
'Server' = $server
'OWA' = $owa.ExternalUrl
'Ews' = $ews.ExternalUrl
'OAB' = $oab.ExternalUrl
'EAS' = $eas.ExternalUrl
'Mapi' = $mapi.ExternalUrl
'OutlookAnywhere' = $oa.ExternalHostname
}
}
$out
} catch {
Write-Warning "Could not connect to $_"
}
}
}