| Protocol and Port | AD and AD DS Usage | Type of traffic |
| TCP and UDP 389 | Directory, Replication, User and Computer Authentication, Group Policy, Trusts | LDAP |
| TCP 636 | Directory, Replication, User and Computer Authentication, Group Policy, Trusts | LDAP SSL |
| TCP 3268 | Directory, Replication, User and Computer Authentication, Group Policy, Trusts | LDAP GC |
| TCP 3269 | Directory, Replication, User and Computer Authentication, Group Policy, Trusts | LDAP GC SSL |
| TCP and UDP 88 | User and Computer Authentication, Forest Level Trusts | Kerberos |
| TCP and UDP 53 | User and Computer Authentication, Name Resolution, Trusts | DNS |
| TCP and UDP 445 | Replication, User and Computer Authentication, Group Policy, Trusts | SMB,CIFS,SMB2, DFSN, LSARPC, NbtSS, NetLogonR, SamR, SrvSvc |
| TCP 25 | Replication | SMTP |
| TCP 135 | Replication | RPC, EPM |
| TCP Dynamic | Replication, User and Computer Authentication, Group Policy, Trusts | RPC, DCOM, EPM, DRSUAPI, NetLogonR, SamR, FRS |
| TCP 5722 | File Replication | RPC, DFSR (SYSVOL) |
| UDP 123 | Windows Time, Trusts | Windows Time |
| TCP and UDP 464 | Replication, User and Computer Authentication, Trusts | Kerberos change/set password |
| UDP Dynamic | Group Policy | DCOM, RPC, EPM |
| UDP 138 | DFS, Group Policy | DFSN, NetLogon, NetBIOS Datagram Service |
| TCP 9389 | AD DS Web Services | SOAP |
| UDP 67 and UDP 2535 | DHCP Note DHCP is not a core AD DS service but it is often present in many AD DS deployments. | DHCP, MADCAP |
| UDP 137 | User and Computer Authentication, | NetLogon, NetBIOS Name Resolution |
| TCP 139 | User and Computer Authentication, Replication | DFSN, NetBIOS Session Service, NetLogon |
月度归档: 2017 年 10 月
AD 巡检(7) 目录数据库状态检测
- 活动目录数据库的大小
- Get-ChildItem -Path C:\Windows\NTDS
- Get-Item -Path C:\Windows\NTDS\ntds.dit
- 查看磁盘空间
- get-disk
- get-partition
- $Object01 = New-Object -TypeName psobject -Property @{
- DiskLetter = Get-CimInstance -Classname Win32_LogicalDisk | select DeviceID
- DiskFreeSpace = (Get-CimInstance -ClassName Win32_LogicalDisk).FreeSpace | ForEach-Object {$PSItem / 1GB}
- }
- $Object02 = New-Object -TypeName psobject -Property @{
- DiskNumber = Get-PhysicalDisk | Select-Object DeviceId
- DiskStatus = Get-PhysicalDisk | Select-Object HeaLthStatus
- DiskMediaType = Get-PhysicalDisk | Select-Object MediaType
- TotalDiskSize = (Get-PhysicalDisk | Select-Object Size).Size | ForEach-Object { $PSItem / 1GB}
- }
- 清理活动目录垃圾信息 ,主要是删除的用户和计算机、卸载的DC 信息的清理 可以使用 ntdsutil 命令行工具
- 日志检查
- 系统产生的所有事件日志文件完整
- $FilePath = (Get-ChildItem -include .evt,.evtx -Path C:\Windows\system32\winevt\Logs -recurse).FullName
- 使用哈希表过滤日记
- $Filter = @{
- Path=$FilePath
- StartTime=$StartTime
- EndTime=$EndTime
- Level=1,2
- }
- $DateTime01 = Get-Date -Format yyyy-MM-dd
- $Logfile = “C:\$DateTime01.csv”
- Get-WinEvent -FilterHashtable $Filter | Out-File $Logfile -Encoding utf8
- 查看日志中错误,警告,关键日志总数
- $CountOfErrorLog = (Get-Content $Logfile | Where-Object { $_ -match ‘^\d’} | Measure-Object).Count
AD 巡检(6) 复制检查
- 使用 repadmin /replsum 命令查看复制汇总
- 使用 repadmin /showrepl 检查相互复制状态
- 使用 Get-ADReplicationFailure -Scope Site 查看站点间复制失败情况 ,范围可以是Site,Domain ,Forest ,Server
- 查看站点间链接开销和复制频率 Get-ADReplicationSiteLink -Filter *
- 检查 指定DC 的目录复制 repadmin /syscall dc01.abc.com
- 强制复制 repadmin /syncall /force
- 测试sysvol状态 dcdiag /test:sysvolcheck
- 测试 AD 健康状态 dcdiag /e /v | findstr ‘没有通过’
- 查检多域之间的信任关系 nltest /trusted domains
- nltest /SC_QUERY:<DomainName> 为<ServerName>上的域查询安全通道
- nltest /SC_VERIFY:<DomainName> 检验<ServerName>上域的安全通道
- nltest /server:servername /sc_query:domainname 工作站与域控制器的信任关系
- nltest/WHOWILL:<Domain> <User> 测定一个域控制器是否能鉴别一个用户帐号
AD 巡检(5) GPO状态检查
- 查看服务器上所有组策略
- get-Gpo -All
- 不建议修改默认的域策略,域控制器策略,建议单独建立组策略
- $params = @{
- All = $true
- Domain = ‘sales.contoso.com’
- Server = ‘DC1’
- ReportType = ‘XML’
- Path = ‘C:\GPOReports\GPOReportsAll.xml’
- }
- Get-GPOReport @params 组策略报告 ,ReportType 可以是Html形式,
- 查看客户端应用的组策略
- gpupdate /force
- gpresult /h gpreport.html
AD 巡检(4) 核心服务及共享目录检查
重点关注 DNS、DFS、Windows Update、 DCOM、NetLogon等服务
- dnscmd /info 查询dns服务器信息
- DNS Server 服务状态 Get-Service -Name DNS
- Server 服务 Get-Service -Name Server Server 服务没启动的话,就没有办法枚举这台DC上面的共享,造成共享文件夹无法访问,另外一方面导致DPM备份失败
- WorkStation 服务 关闭此服务,你将不能访问网络上的共享文件,其他计算机也不能访问本地的共享文件夹。
- Computer Browser 服务 这个服务不用检查,AD上面默认是禁用的。只有客户端才是启用的。Computer Browser服务主要用于维护网上邻居中计算机的最新列表,以及其他一些使用NetBIOS协议的网络设备。“网上邻居”显示的内容正是来源于此,如果你的“网上邻居”无法正常显示,很可能是这个服务没有开启。对于这项服务,建议局域网中的用户不要关闭,否则会影响到正常使用。
- SYSVOL ,NETLOGON,ADMIN$,IPC$,C$ 共享文件夹查看 sysvol可以使用 dcdiag /test:sysvol 命令检查 ,其它文件夹可以使用 net share 或者 get-smbshare 查看