当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 查找域内所有广告网站的所有 DC-Locator SRV 条目

作者:精品下载站 日期:2024-12-14 07:11:50 浏览:14 分类:玩电脑

查找域内所有广告网站的所有 DC-Locator SRV 条目


查找域内所有广告网站的所有 DC-Locator SRV 条目

[玩转系统] 查找域内所有广告网站的所有 DC-Locator SRV 条目

#define the log path!
$logpath = "C:\temp\sites-"

####################################################
#find date and convert to string
$date=((Get-Date).ToString('yyyy-MM-dd-HH-mm-ss'))
#defines the path where to find the log file of this script
$Logfile = $logpath+$date+".log"
#convert date and time to string
$date=((Get-Date).ToString('yyyy-MM-dd-HH-mm-ss'))
#get addomain
$domain = ((Get-WmiObject Win32_ComputerSystem).Domain)
#get all sites
$sites = (([System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites).Name)
Function Write-Log
{
Param ([string]$logstring)
Add-content $Logfile -value $logstring
}
  Write-Log "Domainname: $domain"
  Write-Log "-------------" 
foreach ($site in $sites){
  $srv = (Resolve-DnsName -Type SRV _ldap._tcp.$site._sites.$domain | ft Name,Type,NameTarget,Port | Out-String )
  Write-Log "Sitename: $site"
  Write-Log "-------------"
  Write-Log "$srv"
}

[玩转系统] 查找域内所有广告网站的所有 DC-Locator SRV 条目

附加功能将根据时间和需求实施。如果有人有特殊问题/愿望,只需留言即可。

玩得开心。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯