code-test

2013年5月20日 星期一

Windows Server 2008 R2 Active Directory 指令筆記

Windows Server 2008 R2 Active Directory 指令筆記

轉貼來自  記載著 will 在網路世界的學習心得與技術分享

http://blog.miniasp.com/post/2010/11/27/Windows-Server-2008-R2-Active-Directory-Troubleshooting.aspx

針對 AD 基本檢查與除錯有以下關鍵

  • 檢視系統新啟動的事件記錄 (重新開機到開機完成這段時間的事件記錄)
  • 檢視 網域主控站 (Domain Controller) 相關服務的啟動狀態
    • KDC
    • Netlogon
    • FRS
    • w32time
  • 檢查網路相關設定
    • IP
    • DNS
  • 檢查 DNS 伺服器上的 SRV 紀錄是否都正常
    • 缺少記錄?
    • 重複記錄?
  • 檢視 AD 五大角色 (FSMO) 及位置
    • netdom query fsmo
    • FSMO (Flexible Single Master Operations) 五大角色分別為:
      • 架構主機 (Schema Master)
        • 負責更新目錄架構。
      • 網域命名主機 (Domain Naming Master)
        • 負責變更樹系網域目錄名稱空間。
      • 基礎架構主機 (Infrastructure Master)
        • 跨網域物件參照中,負責更新物件 SID 與辨別名稱。
      • RID 主機 (RID Master)
        • 負責處理 RID (Relative ID) 集區中來自給定的網域的所有 DC 要求。
      • PDC 模擬器 (PDC Emulator)
        • 對舊版的工作站、成員伺服器與網域控制站宣稱自己為主要網域控制站 (PDC)。
  • 檢查 網域主控站 (Domain Controller) 預設分享是否有異常
    • SYSVOL
    • NETLOGON
  • 檢查 網域主控站 (Domain Controller) 在 AD 中的 UserAccountControl 屬性是否為 532480
    • 網域主控站 (Domain Controller) 預設 UserAccountControl 屬性為 532480
    • 成員伺服器 ( Member Server ) 預設 UserAccountControl 屬性為 4096
    • 網域使用者 ( User ) 預設 UserAccountControl 屬性為 512
  • 檢查 C:\Windows\Debug 目錄下的記錄檔

常用的 AD 診斷工具與常用指令

Windows Server 2008 R2 群組原則物件 (GPO) (Group Policy Object) 疑難排解

  • 瞭解 GPO 元件及結構
    • 群組原則容器 (GPC) – Group Policy Container
      • 版本資訊
      • 狀態資訊
      • 元件清單
    • 群組原則範本 (GPT) – Group Policy Template
      • C:\Windows\SYSVOL\sysvol\<DOMAIN>\Policies\{<GUID>}
      • 註: 在 Windows Server 2003 時稱為 ADM (系統管理範本)
  • 瞭解 GPO 繼承模式
    • Site (站台) –> Domain (網域) –> OU (組織單位)
  • 瞭解 GPO 套用模式
    • GPO 強制套用模式 ( Enforcing GPOs )
    • GPO 阻礙繼承模式 ( Blocking Inheritance )
  • 新群組原則 - 本機群組原則物件處理
    • 用戶端 GPO 套用順序
      • 本機 GPO > Site > Domain > OU
    • Windows Vista / 7 以上版本支援 關閉本機群組原則物件處理
      image
    • 若啟用 ”關閉本機群組原則物件處理” 套用順序變成
      • Site > Domain > OU
  • GPO 在 網域主控站 (Domain Controller) 可能發生的問題
    • SYSVOL 不一致
      • AD 在進行 GPO 檔案複寫時有問題導致
      • 可使用 GPOTool.exe 工具進行檢測 DC 之間 SYSVOL 的一致性
        指令範例:gpotool /verbose
        備註: GPOTool.exe 工具在 Windows Server 2003 Resource Kit Tools 裡面!
      • 經實測,gpotool 有時後雖然會回傳 sysvol mismatch 的錯誤,但事實上如果 GPO 套用的過程沒有問題的話,可以不予理會。SYSVOL 資料夾的覆寫主要根據 DFSR 或 FRS 服務進行複寫,這部分與 AD 複寫並不一樣。以下英文描述可供參考:

SYSVOL mismatch: Can be caused by FRS failing to replicate files, or folders between domain controllers. There are several possible reasons for this, for example file sharing violations and FRS replication filters (an administrator drops a file to SYSVOL, which is excluded from replication by FRS filters, so this file will never replicate to other domain controllers and create a gpotool.exe error message. Please, read KB 296944 for more information.)  To troubleshoot this error message you can start with creating a dir /s ouputs from the domain controllers listed in the gpotool.exe output and compare the number of files and folders. (Windiff.exe can be used as well.)

    • Version 不一致
      • 若 GPC 版本編號 > GPT 版本編號
        • 直接修改 GPT 版本編號
      • 若 GPT 版本編號 > GPC 版本編號
        • 直接修改 GPC 版本編號
    • File not found
      • SYSVOL 目錄下不存在特定 Policy 資料夾
    • Access Denied
      • SYSVOL 目錄下的資料夾存取權限問題
  • GPO 在 成員伺服器 ( Member Server ) 可能發生的問題 ( 大多是網路連線問題 )
    • TCP/IP 連線問題
      • IP 設定錯誤
      • Switch 故障
      • 網路線品質不良
    • DNS 名稱解析問題
      • DHCP 指派的 DNS 不正確 (如更換 IP 分享器之後啟用了 DHCP 又設定錯誤的狀況)
      • 指定錯誤的 DNS 位址 ( 例如使用者用的是網域電腦但卻設定了 168.95.1.1 為 DNS )
    • 慢速網路 (slowlink)
      • 在 20 年前的網路的確有可能有此問題,現在很少有慢速網路的狀況。
    • 快速登入 (Fast Logon)
      • 使用者在開機完成後會出現登入畫面,不過看到登入畫面並不代表作業系統已經可以提供網路連線,如果你的電腦開機速度過快,而你又在這時立即登入的話,就會有可能會導致無法登入 AD 或 GPO 無法套用的情況!

GPO 問題在【用戶端】可用的工具

GPO 問題在【用戶端】可善用 GPO 套用記錄檔來檢查問題

在啟用 GPO 套用記錄 後,該檔案詳細記錄 GPO 套用的過程,其內容資訊非常豐富並可幫助你找出用戶端電腦在套用 GPO 時的各種問題,例如登入時間過長或無法套用特定原則等問題。備註:請在用戶端電腦新增機碼以啟用紀錄。

Windows Server 2008 / Windows Vista 以後的版本可透過設定以下機碼啟用紀錄功能:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Diagnostics
  • 值名稱:GPSvcDebugLevel
  • 值類型:REG_DWORD
  • 值資料:0x00030002 (hex)   -- 備註:十進位數值為 196610
  • 快速套用指令
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Diagnostics" /v "GPSvcDebugLevel" /t REG_DWORD /d 0x00030002 /f
  • 快速關閉指令
    reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Diagnostics" /v "GPSvcDebugLevel" /f
  • GPO 套用記錄檔所在路徑
    • C:\Windows\debug\UserMode\GPSVC.log

Windows Server 2003 / Windows XP 以前(含) 的版本可透過設定以下機碼啟用紀錄功能:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  • 值名稱:UserEnvDebugLevel
  • 值類型:REG_DWORD
  • 值資料:0x00030002 (hex)   -- 備註:十進位數值為 196610
  • 快速套用指令
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "UserEnvDebugLevel" /t REG_DWORD /d 0x00030002 /f
  • 快速關閉指令
    reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "UserEnvDebugLevel" /f
  • GPO 套用記錄檔所在路徑
    • C:\Windows\debug\UserMode\Userenv.log

相關連結

沒有留言:

張貼留言