Kiểm tra tình trạng Exchange Server bằng tập lệnh PowerShell
Các sự cố và sự cố đang xảy ra về Exchange Server và bạn muốn kiểm tra tình trạng của Exchange Server. Cách tốt nhất để kiểm tra sức khỏe là gì? Có lẽ bạn muốn thêm một Exchange Server mới vào môi trường và trước khi thực hiện điều đó, bạn muốn kiểm tra tình trạng của nó. Hãy xem cách kiểm tra tình trạng Exchange Server bằng tập lệnh PowerShell tuyệt vời.
Tại sao bạn muốn kiểm tra tình trạng Exchange Server
Bạn nên kiểm tra tình trạng của Exchange Server nếu có sự cố, sự cố hoặc thay đổi mà bạn phải áp dụng:
Có vấn đề với Exchange Server
Trước khi nâng cấp Exchange Server CU lên phiên bản mới nhất
Trước khi bạn cài đặt trình hướng dẫn cấu hình kết hợp cho quá trình di chuyển Office 365
-
Trước khi bạn tạo DAG giữa các máy chủ Exchange
Giới thiệu Exchange Server mới trong tổ chức
Kiểm tra tình trạng máy chủ Exchange Tập lệnh PowerShell
Tập lệnh Exchange Server Health Checker giúp phát hiện các sự cố cấu hình phổ biến được biết là gây ra sự cố về hiệu suất và các sự cố kéo dài khác do thay đổi cấu hình đơn giản trong Môi trường Exchange gây ra. Nó cũng giúp thu thập thông tin hữu ích về máy chủ của bạn để giúp tăng tốc độ thu thập thông tin chung của máy chủ.
Tại sao tôi khuyên bạn nên sử dụng tập lệnh PowerShell này:
Hỗ trợ Exchange Server 2013/2016/2019
Một nhật ký thay đổi được lưu giữ với tất cả các bản sửa lỗi/tính năng
Nó được tạo và duy trì bởi các Kỹ sư của Microsoft
Luôn tìm kiếm sự cải tiến
Mở cửa cho các đề xuất và tính năng
Đó là PowerShell 100%
Điều cần biết là nó có thể hoạt động trên Exchange Server 2007/2010 nhưng không được hỗ trợ.
Tải xuống và chuẩn bị tập lệnh kiểm tra Exchange Health
Tải xuống tập lệnh PowerShell của trình kiểm tra tình trạng Exchange từ trang chính thức (GitHub). Tại thời điểm viết bài này, tôi sẽ kiểm tra Exchange Server Performance Health Checker Script phiên bản 3.1.1.
Khả năng lớn là nếu bạn đọc bài viết này thì phiên bản đã bị thay đổi. Đó là bởi vì nhóm phát hành một vài bản cập nhật mỗi tháng, điều này thật tuyệt vời! Nếu có bất kỳ lỗi, đề xuất tính năng hoặc phản hồi nào, bạn có thể gửi email cho họ theo địa chỉ extoolsfeedback@microsoft.com.
Đặt tập lệnh PowerShell HealthChecker.ps1 vào thư mục Exchange Server C:\scripts. Nếu bạn không có thư mục script, hãy tạo một thư mục. Đảm bảo kiểm tra xem tệp có được bỏ chặn hay không để tránh bất kỳ lỗi nào khi chạy tập lệnh. Đọc thêm trong bài viết Lỗi không được ký điện tử khi chạy tập lệnh PowerShell.
Xác minh chữ ký trước khi chạy tập lệnh bằng lệnh ghép ngắn Get-AuthenticodeSignature.
[PS] C:\>Get-AuthenticodeSignature -FilePath "C:\Scripts\HealthChecker.ps1" | ft -AutoSize
Directory: C:\Scripts
SignerCertificate Status Path
----------------- ------ ----
ABDCA79AF9DD48A0EA702AD45260B3C03093FB4B Valid HealthChecker.ps1Chạy tập lệnh PowerShell của Exchange Server Health Checker
Chạy Exchange Management Shell với tư cách quản trị viên trên Exchange Server. Thay đổi đường dẫn thư mục thành C:\scripts. Chạy tập lệnh HealthChecker.ps1 và chỉ định Exchange Server. Nếu bạn không xác định Exchange Server, nó sẽ kiểm tra localhost (máy chủ bạn đang sử dụng hiện tại).
[PS] C:\scripts>.\HealthChecker.ps1 -Server "EX01-2016"
Exchange Health Checker version 3.1.1
Virtual Machine detected. Certain settings about the host hardware cannot be detected from the virtual machine. Verify on the VM Host that:
- There is no more than a 1:1 Physical Core to Virtual CPU ratio (no oversubscribing)
- If Hyper-Threading is enabled do NOT count Hyper-Threaded cores as physical cores
- Do not oversubscribe memory or use dynamic memory allocation
Although Exchange technically supports up to a 2:1 physical core to vCPU ratio, a 1:1 ratio is strongly recommended for performance reasons. Certain third party Hyper-Visors such as VMWare have their own guidance.
VMWare recommends a 1:1 ratio. Their guidance can be found at https://www.vmware.com/files/pdf/Exchange_2013_on_VMware_Best_Practices_Guide.pdf.
Related specifically to VMWare, if you notice you are experiencing packet loss on your VMXNET3 adapter, you may want to review the following article from VMWare: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2039495.
For further details, please review the virtualization recommendations on Microsoft Docs at the following locations:
Exchange 2013: https://learn.microsoft.com/en-us/exchange/exchange-2013-virtualization-exchange-2013-help#requirements-for-hardware-virtualization.
Exchange 2016/2019: https://learn.microsoft.com/en-us/exchange/plan-and-deploy/virtualization?view=exchserver-2019.
Exchange Information
--------------------
Name: EX01-2016
Version: Exchange 2016 CU17
Build Number: 15.1.2044.4
Error: Out of date Cumulative Update. Please upgrade to one of the two most recently released Cumulative Updates. Currently running on a build that is 194 days old.
Server Role: Mailbox
MAPI/HTTP Enabled: True
Exchange Server Maintenance: Server is not in Maintenance Mode
Operating System Information
----------------------------
Version: Microsoft Windows Server 2016 Standard Evaluation
System Up Time: 2 day(s) 16 hour(s) 34 minute(s) 28 second(s)
Time Zone: W. Europe Standard Time
Dynamic Daylight Time Enabled: True
.NET Framework: 4.8
Page File Size: Error: System is set to automatically manage the pagefile size.
Power Plan: Balanced --- Error
Http Proxy Setting: <None>
Visual C++ 2012: Redistributable is outdated
Visual C++ 2013: Redistributable is outdated
Note: For more information about the latest C++ Redistributeable please visit: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
This is not a requirement to upgrade, only a notification to bring to your attention.
Server Pending Reboot: False
Processor/Hardware Information
------------------------------
Type: VMWare
Processor: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Number of Processors: 4
Note: Please make sure you are following VMware's performance recommendation to get the most out of your guest machine. VMware blog 'Does corespersocket Affect Performance?' https://blogs.vmware.com/vsphere/2013/10/does-corespersocket-affect-performance.html
Number of Physical Cores: 4
Number of Logical Cores: 4
Hyper-Threading: Disabled
All Processor Cores Visible: Passed
Max Processor Speed: 2304
Physical Memory: 12 GB
NIC Settings Per Active Adapter
-------------------------------
Interface Description: vmxnet3 Ethernet Adapter [Ethernet0]
Driver Date: 2019-07-11
Driver Version: 1.8.16.0
MTU Size: 1500
RSS Enabled: True
Link Speed: 10000 Mbps --- This may not be accurate due to virtualized hardware
IPv6 Enabled: True
IPv4 Address:
Address: 192.168.1.52\24 Gateway: 192.168.1.1
IPv6 Address:
DNS Server: 192.168.1.51
Registered In DNS: True
Sleepy NIC Disabled: False --- Warning: It's recommended to disable NIC power saving options
More Information: http://support.microsoft.com/kb/2740020
Packets Received Discarded: 0
Frequent Configuration Issues
-----------------------------
TCP/IP Settings: Not Set
Error: Without this value the KeepAliveTime defaults to two hours, which can cause connectivity and performance issues between network devices such as firewalls and load balancers depending on their configuration.
More details: https://techcommunity.microsoft.com/t5/Exchange-Team-Blog/Checklist-for-troubleshooting-Outlook-connectivity-in-Exchange/ba-p/604792
RPC Min Connection Timeout: 0
More Information: https://blogs.technet.microsoft.com/messaging_with_communications/2012/06/06/outlook-anywhere-network-timeout-issue/
CTS Processor Affinity Percentage: 0
Credential Guard Enabled: False
Security Settings
-----------------
LmCompatibilityLevel Settings: 3
Description: Clients use only NTLMv2 authentication, and they use NTLMv2 session security if the server supports it. Domain controllers accept LM, NTLM, and NTLMv2 authentication.
TLS 1.0
Server Enabled: True
Server Disabled By Default: False
Client Enabled: True
Client Disabled By Default: False
TLS 1.1
Server Enabled: True
Server Disabled By Default: False
Client Enabled: True
Client Disabled By Default: False
TLS 1.2
Server Enabled: True
Server Disabled By Default: False
Client Enabled: True
Client Disabled By Default: False
Certificate:
FriendlyName: Microsoft Exchange Server Auth Certificate
Thumbprint: 96AC7BAD02F000A6C9B0DFEB5F15A59FE396D5F2
Lifetime in days: 1758
Key size: 2048
Bound to services: SMTP
Current Auth Certificate: True
SAN Certificate: False
Namespaces:
Microsoft Exchange Server Auth Certificate
Certificate:
FriendlyName: Microsoft Exchange
Thumbprint: 8CF11037A346A3BE602E99171FFB32C07F3F2196
Lifetime in days: 1784
Key size: 2048
Bound to services: IMAP, POP, IIS, SMTP
Current Auth Certificate: False
SAN Certificate: True
Namespaces:
EX01-2016
EX01-2016.exoip.local
Certificate:
FriendlyName: mail.exoip.com @ 2020/10/3 16:46:13
Thumbprint: 11A8E3212103DD17734E46F5F4DFEA1ABC41AD35
Lifetime in days: 5
Key size: 3072
Bound to services: IIS, SMTP
Current Auth Certificate: False
SAN Certificate: True
Namespaces:
autodiscover.exoip.com
mail.exoip.com
Certificate:
FriendlyName: WMSVC-SHA2
Thumbprint: A520A23C9032B0D2B62BA812F2DBF91BB580D228
Lifetime in days: 3555
Key size: 2048
Bound to services: None
Current Auth Certificate: False
SAN Certificate: False
Namespaces:
WMSvc-SHA2-EX01-2016
Valid Auth Certificate Found On Server: True
SMB1 Installed: True
SMB1 Blocked: False
SMB1 should be uninstalled SMB1 should be blocked
More Information: https://techcommunity.microsoft.com/t5/exchange-team-blog/exchange-server-and-smbv1/ba-p/1165615
Security Vulnerability: CVE-2020-16875
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-16875 for more information.
Security Vulnerability: CVE-2020-16969
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-16969 for more information.
Security Vulnerability: CVE-2020-17083
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17083 for more information.
Security Vulnerability: CVE-2020-17084
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17084 for more information.
Security Vulnerability: CVE-2020-17085
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17085 for more information.
Security Vulnerability: CVE-2020-17117
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17117 for more information.
Security Vulnerability: CVE-2020-17132
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17132 for more information.
Security Vulnerability: CVE-2020-17141
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17141 for more information.
Security Vulnerability: CVE-2020-17142
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17142 for more information.
Security Vulnerability: CVE-2020-17143
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-17143 for more information.
Security Vulnerability: CVE-2020-1147
See: https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-1147 for more information.
Exchange Web App Pools
----------------------
Web App Pool: GC Server Mode Enabled | Status
MSExchangeServicesAppPool: False | Started
MSExchangeMapiFrontEndAppPool: False | Started
MSExchangeOWAAppPool: False | Started
MSExchangeRestAppPool: False | Started
MSExchangeMapiAddressBookAppPool: False | Started
MSExchangeRpcProxyFrontEndAppPool: False | Started
MSExchangePowerShellAppPool: False | Started
MSExchangePowerShellFrontEndAppPool: False | Started
MSExchangeRestFrontEndAppPool: False | Started
MSExchangeMapiMailboxAppPool: False | Started
MSExchangeOABAppPool: False | Started
MSExchangePushNotificationsAppPool: False | Started
MSExchangeOWACalendarAppPool: False | Started
MSExchangeAutodiscoverAppPool: False | Started
MSExchangeECPAppPool: False | Started
MSExchangeSyncAppPool: True | Started
MSExchangeRpcProxyAppPool: False | Started
Output file written to .\HealthCheck-EX01-2016-20201227132103.txt
Exported Data Object Written to .\HealthCheck-EX01-2016-20201227132103.xmlTập lệnh Exchange HealthChecker.ps1 sẽ tạo ra hai tệp. Các tệp này được tạo trong cùng thư mục của tập lệnh. Trong ví dụ này, đó là thư mục C:\scripts.
1x tệp TXT: Tệp txt giống với đầu ra trong PowerShell. Nhưng nó rất hữu ích nếu bạn muốn đính kèm nó vào email hoặc đặt nó vào một thư mục.
-
Tệp XML 1x: Để xem tệp XML tốt hơn, bạn phải chạy một lệnh khác để tạo báo cáo. Xem bên dưới.
Tạo báo cáo tình trạng Exchange
[PS] C:\scripts>.\HealthChecker.ps1 -BuildHtmlServersReport -HtmlReportFile "EX01-2016Report.html"Một EX01-2016Report.html mới được tạo trong thư mục tập lệnh.
Mở báo cáo tình trạng Exchange EX01-2016Báo cáo.
Bạn sẽ thấy màu sắc:
Xám: Mục thông tin
Xanh lục: Đã tìm thấy cài đặt phù hợp với đề xuất
Vàng: Cài đặt đưa ra cảnh báo mà bạn có thể xem
Đỏ: Cài đặt có thể gây ra sự cố về hiệu suất
Những thứ quan trọng nhất mà bạn cần chăm sóc là những thứ màu đỏ. Đi qua nó một cách cẩn thận.
Lưu ý rằng hầu hết các đề xuất này chỉ áp dụng cho Exchange 2013/2016/2019. Tập lệnh sẽ chạy trên Exchange 2010/2007 nhưng đầu ra bị hạn chế hơn.
Bạn có nhiều hơn một Exchange Server đang chạy? Bạn muốn có một báo cáo về các Exchange Server này. Chúng ta hãy xem xét điều đó trong bước tiếp theo.
Tạo báo cáo tình trạng Exchange cho nhiều Máy chủ Exchange
Nhận báo cáo tình trạng của Exchange Server khác. Trong ví dụ của tôi, Exchange Server EX02-2016.
[PS] C:\scripts>.\HealthChecker.ps1 -Server "EX02-2016"Tập lệnh đã tạo hai tệp trong thư mục tập lệnh.
Tạo báo cáo tình trạng Exchange. Lần này, chỉ sử dụng tham số -BuildHtmlServersReport. Nó sẽ tập hợp tất cả các tệp XML trong thư mục C:\scripts và tạo báo cáo tình trạng Exchange.
[PS] C:\scripts>.\HealthChecker.ps1 -BuildHtmlServersReportTệp ExchangeAllServersReport.html mới được tạo trong thư mục tập lệnh.
Tạo báo cáo tình trạng Exchange cho tất cả Máy chủ Exchange
Một tùy chọn khác là chạy lệnh ghép ngắn để tạo báo cáo cho tất cả Máy chủ Exchange. Nó sẽ chạy báo cáo HTML và tự động mở nó.
[PS] C:\scripts>Get-ExchangeServer | ?{$_.AdminDisplayVersion -Match "^Version 15"} | %{.\HealthChecker.ps1 -Server $_.Name}; .\HealthChecker.ps1 -BuildHtmlServersReport; .\ExchangeAllServersReport.htmlNếu báo cáo không tự động mở, bạn có thể tìm thấy báo cáo trong thư mục C:\scripts. Mở báo cáo tình trạng Exchange Server ExchangeAllServersReport.
Nếu mọi thứ hiển thị màu xanh lá cây, bạn đã hoàn tất. Nếu nó màu vàng, hãy nhìn vào nó. Bạn có thấy các mục màu đỏ trong báo cáo tình trạng Exchange không? Chúng tôi khuyên bạn nên sửa nó.
Đọc thêm: Kiểm tra hộp thư tình trạng Exchange »
Phần kết luận
Trong bài viết này, bạn đã tìm hiểu cách kiểm tra tình trạng của Exchange Server bằng tập lệnh PowerShell HealthChecker.ps1. Một số tập lệnh trên internet sẽ thực hiện kiểm tra tình trạng Exchange Server, nhưng các tác giả không cập nhật tập lệnh như tập lệnh này.
Trong thế giới công nghệ, bạn phải cung cấp các tính năng mới, sửa lỗi và điều chỉnh để tận dụng hết tiềm năng của phần mềm. Đó là lý do tại sao tôi khuyên bạn chỉ nên sử dụng tập lệnh này để kiểm tra tình trạng Exchange. Đó là tập lệnh PowerShell tuyệt vời mà bạn phải có trong bộ sưu tập của mình.
bạn có thích bài viết này? Bạn cũng có thể thích Đưa Exchange Server ra khỏi chế độ bảo trì. Đừng quên theo dõi chúng tôi và chia sẻ bài viết này.







