-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c273d45
commit fbbd73a
Showing
2 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#Database Status | ||
write-host " | ||
-------------------------------------------------------------------------------- | ||
Database Status | ||
-------------------------------------------------------------------------------- | ||
" -foregroundcolor yellow | ||
$Databases = Get-MailboxDatabaseCopyStatus -Server $env:Computername | ||
foreach ($Database in $Databases) { | ||
if ($Database.Status -eq "Mounted" -or $Database.Status -eq "Healthy") { | ||
write-host "Database" $Database.DatabaseName "on Server" $Database.Mailboxserver "is " -NoNewline | ||
write-host $Database.Status -ForegroundColor green | ||
} | ||
else { | ||
write-host "Database" $Database.DatabaseName "on Server" $Database.Mailboxserver "is " -NoNewline | ||
write-host $Database.Status -ForegroundColor red | ||
} | ||
} | ||
|
||
#Queue Status | ||
write-host " | ||
-------------------------------------------------------------------------------- | ||
Queue Status | ||
-------------------------------------------------------------------------------- | ||
" -foregroundcolor yellow | ||
$Queues = Get-Queue -Server $env:Computername | ||
foreach ($Queue in $Queues) { | ||
if ($Queue.Status -eq "Ready") { | ||
write-host "Queue" $Queue.QueueIdentity.Type "on Server" $Queue.QueueIdentity.Server "is " -NoNewline | ||
write-host $Queue.Status -ForegroundColor green | ||
} | ||
else { | ||
write-host "Queue" $Queue.QueueIdentity.Type "on Server" $Queue.QueueIdentity.Server "is " -NoNewline | ||
write-host $Queue.Status -ForegroundColor red | ||
} | ||
} | ||
|
||
#Service Status | ||
write-host " | ||
-------------------------------------------------------------------------------- | ||
Service Status | ||
-------------------------------------------------------------------------------- | ||
" -foregroundcolor yellow | ||
$ExchangeServices = Get-Service -DisplayName "Microsoft Exchange*" | where {$_.StartType -eq "Automatic"} | ||
foreach ($ExchangeService in $ExchangeServices) { | ||
if ($ExchangeService.Status -eq "Running") { | ||
write-host "Service" $ExchangeService.ServiceName "on Server" $env:Computername "is " -NoNewline | ||
write-host $ExchangeService.Status -ForegroundColor green | ||
} | ||
else { | ||
write-host "Service" $ExchangeService.ServiceName "on Server" $env:Computername "is " -NoNewline | ||
write-host $ExchangeService.Status -ForegroundColor red | ||
} | ||
} | ||
#Volume Status | ||
write-host " | ||
-------------------------------------------------------------------------------- | ||
Volume Status | ||
-------------------------------------------------------------------------------- | ||
" -foregroundcolor yellow | ||
$props = @( | ||
'DriveLetter' | ||
'FileSystemLabel' | ||
'FileSystem' | ||
'DriveType' | ||
'HealthStatus' | ||
'OperationalStatus' | ||
@{ | ||
Name = 'SizeRemaining' | ||
Expression = { "{0:N3} Gb" -f ($_.SizeRemaining/ 1Gb) } | ||
} | ||
@{ | ||
Name = 'Size' | ||
Expression = { "{0:N3} Gb" -f ($_.Size / 1Gb) } | ||
} | ||
@{ | ||
Name = 'PercentFree' | ||
Expression = { "{0:P}" -f ($_.SizeRemaining / $_.Size) } | ||
} | ||
) | ||
|
||
$Volumes = Get-Volume | Select-Object $props | where {$_.Size -gt 1GB} | ||
foreach ($Volume in $Volumes) { | ||
if ($Volume.FileSystem -eq "NTFS" -or $Volume.FileSystem -eq "ReFS" -and $Volume.HealthStatus -eq "Healthy" -and $Volume.PercentFree -gt 10) { | ||
write-host "Volume" $Volume.Driveletter $Volume.FileSystemLabel "on Server" $env:Computername "is " -NoNewline | ||
write-host $Volume.HealthStatus -ForegroundColor green -NoNewline | ||
write-host " with " -NoNewline | ||
write-host $Volume.PercentFree -ForegroundColor green -NoNewline | ||
write-host " remaining capacity" | ||
} | ||
elseif ($Volume.FileSystem -eq "NTFS" -or $Volume.FileSystem -eq "ReFS" -and $Volume.HealthStatus -eq "Healthy" -and $Volume.PercentFree -lt 10) { | ||
write-host "Volume" $Volume.Driveletter $Volume.FileSystemLabel "on Server" $env:Computername "is " -NoNewline | ||
write-host $Volume.HealthStatus -ForegroundColor green -NoNewline | ||
write-host " with " -NoNewline | ||
write-host $Volume.PercentFree -ForegroundColor red -NoNewline | ||
write-host " remaining capacity" | ||
} | ||
elseif ($Volume.FileSystem -eq "NTFS" -or $Volume.FileSystem -eq "ReFS" -and $Volume.HealthStatus -ne "Healthy" -and $Volume.PercentFree -gt 10) { | ||
write-host "Volume" $Volume.Driveletter $Volume.FileSystemLabel "on Server" $env:Computername "is " -NoNewline | ||
write-host $Volume.HealthStatus -ForegroundColor red -NoNewline | ||
write-host " with " -NoNewline | ||
write-host $Volume.PercentFree -ForegroundColor green -NoNewline | ||
write-host " remaining capacity" | ||
} | ||
elseif ($Volume.FileSystem -eq "NTFS" -or $Volume.FileSystem -eq "ReFS" -and $Volume.HealthStatus -ne "Healthy" -and $Volume.PercentFree -lt 10) { | ||
write-host "Volume" $Volume.Driveletter $Volume.FileSystemLabel "on Server" $env:Computername "is " -NoNewline | ||
write-host $Volume.HealthStatus -ForegroundColor red -NoNewline | ||
write-host " with " -NoNewline | ||
write-host $Volume.PercentFree -ForegroundColor red -NoNewline | ||
write-host " remaining capacity" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# Get-ExchangeStatus | ||
Display Exchange Server Health Status | ||
# Get-ExchangeStatus.ps1 | ||
|
||
This script displays important Exchange Server health parameters such as database, queue, services and storage space. | ||
|
||
## Usage | ||
|
||
Download and copy this script to an Exchange Server. | ||
Run the script or start it directly when loading the Exchange Management Shell. | ||
|
||
## Tested Exchange / Windows Server Versions | ||
|
||
- Exchange Server 2019 | ||
- Windows Server 2022 | ||
|
||
## Visit my Blog for an example | ||
|
||
[FrankysWeb](https://www.frankysweb.de/kleines-script-um-den-exchange-server-status-zu-ermitteln/) |