Script Name: ExchangeServiceChecker.ps1
The ExchangeServiceChecker.ps1 script is a PowerShell script that helps administrators check the status of Exchange-related services on multiple servers remotely. It also attempts to start any services that are not running and provides a summary of the results and encountered errors.
- PowerShell version 5.1 or later.
- Admin credentials with sufficient privileges to access and manage services on the target servers.
-
Clone or download this repository to your local machine.
-
Open PowerShell in the directory where the script is located.
-
Run the script using the following command:
.\ExchangeServiceChecker.ps1
-
The script will prompt you to enter your admin credentials. This is necessary to access the remote servers and interact with services.
-
The script will then check the status of Exchange-related services on each server specified in the
$Servers
array. If any services are not running, it will attempt to start them. -
After processing all servers, the script will display a summary of services that were not running and have been started, if applicable.
-
If there were any errors encountered during the script execution, the script will display a summary of the errors.
Edit the $Servers
array in the script to specify the names of the Exchange servers you want to check.
Before running the script, ensure that WinRM (Windows Remote Management) is configured on both the local and remote machines. To enable WinRM on the local machine, open PowerShell as an administrator and run the following command:
Enable-PSRemoting -Force
To enable WinRM on remote machines, you can use the following command (replace <ServerName>
with the actual name of the remote server):
Enable-WSManCredSSP -Role Server -Force
winrm set winrm/config/client/auth '@{CredSSP="true"}'
winrm set winrm/config/client '@{TrustedHosts="<ServerName>"}'
Notes
-
Please ensure that you have the necessary permissions and network connectivity to access the target servers remotely.
-
The script uses the
Test-Connection
cmdlet to check if each server is online before attempting to interact with it. -
If any errors occur during the script execution, they will be recorded in the
$ErrorList
array and displayed at the end of the execution.
This script is provided as-is without any warranty. Use it at your own risk. The script author is not responsible for any damages or losses caused by using this script.
Author: Letlaka
Please feel free to contribute to the script by creating pull requests or reporting issues. Your feedback and contributions are highly appreciated!