-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfindADFS.ps1
29 lines (23 loc) · 985 Bytes
/
findADFS.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
function Find-ADFS {
param (
[string]$domain
)
$configPartitionPath = "LDAP://CN=Configuration,$((Get-WmiObject Win32_ComputerSystem).Domain)"
try {
# Try to bind to the Configuration partition
$configPartition = [adsi]$configPartitionPath
# Check if the AD FS container exists in the Configuration partition
$adfsContainer = $configPartition.Children | Where-Object { $_.SchemaClassName -eq 'FederationService' }
if ($adfsContainer -ne $null) {
# Get the server name where AD FS is installed
$adfsserver = $adfsContainer.Properties["serviceHostName"].Value
Write-Host "AD FS is installed on server: $adfsserver"
} else {
Write-Host "AD FS is not installed in the domain."
}
} catch {
Write-Host "Error: $_"
}
}
$currentDomain = (Get-WmiObject Win32_ComputerSystem).Domain
Find-ADFS -domain $currentDomain