Skip to content

Instantly share code, notes, and snippets.

Last active Dec 24, 2015
What would you like to do?
gets known registered service connection points (currently only exchange and ad rights management services) from active directory domain
Script to find AD, find the known registered Service Connection Point's, an list some information about them.
detects dns domain on the network you're on
tries to detect default domain from dns server
connects to AD, get information about AD RMS, Exchange (possible to add others!)
Import-Module ActiveDirectory
$Networks = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE
#detection 1
#detection 2
for($i=1; $i -lt $arr.length; $i++ )
#auto choose
if($dnsdomain -eq $otherdnsdomain)
write-host "autochoise: using $dnsdomain"
#manual choice
write-host "choose wiseley"
write-host "1. $dnsdomain - $server"
write-host "2. $otherdnsdomain - $otherserver"
write-host "3. $env:USERDNSDOMAIN"
write-host "4. enter custom domain"
$choice=read-host "choice"
1 {
2 {
3 {
$dnsdomain=read-host "enter dnsdomain"
$server=read-host "enter known domain controller"
foreach($word in $arr)
$creds = get-credential
write-host "connecting to $server, searchbase being $searchbase"
$objects=Get-ADObject -SearchBase $searchbase -Filter "objectclass -eq 'serviceconnectionpoint'" -server $server -Credential $creds
foreach($obj in $objects)
$object=Get-ADObject $obj -server $server -Credential $creds -properties *
write-host $object.serviceBindingInformation
write-host "not found"
$rmsSCP=$detailedobjects | where {$_.distinguishedname -eq "cn=rightsmanagementservices,cn=services,$searchbase"}
#CN=Microsoft Exchange Online,CN=Microsoft Exchange Autodiscover,CN=Services,$searchbase
$exchangeSCP=$detailedobjects | where {$_.distinguishedname -eq "CN=Microsoft Exchange Online,CN=Microsoft Exchange Autodiscover,CN=Services,$searchbase"}
$searchbase="cn=microsoft exchange,cn=services,cn=configuration,$var"
$exchangename=Get-ADObject -SearchBase $searchbase -Filter "*" -SearchScope 1 -server $server -Credential $creds
$searchbase="CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),cn=$exchangename,cn=microsoft exchange,cn=services,cn=configuration,$var"
$exchangeservers=Get-ADObject -SearchBase $searchbase -Filter "*" -SearchScope 1 -server $server -Credential $creds
write-host $exchangeservers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment