76 lines
2.3 KiB
PowerShell
76 lines
2.3 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
<Overview of script>
|
|
|
|
.NOTES
|
|
Version : 1.0
|
|
Author : Hubert CORNET
|
|
Creation Date : <Date>
|
|
Purpose/Change : <Initial script development>
|
|
|
|
.LINK
|
|
https://www.tips-of-mine.fr
|
|
|
|
.EXEMPLE
|
|
<Example goes here. Repeat this attribute for more than one example>
|
|
|
|
.DESCRIPTION
|
|
<Brief description of script>
|
|
|
|
.PARAMETER <Parameter_Name>
|
|
<Brief description of parameter input required. Repeat this attribute if required>
|
|
|
|
.INPUTS
|
|
<Inputs if any, otherwise state None>
|
|
|
|
.OUTPUTS
|
|
<Outputs if any, otherwise state None - example: Log file stored in C:\Windows\Temp\<name>.log>
|
|
#>
|
|
|
|
#---------------------------------------------------------[Initialisations]--------------------------------------------------------
|
|
|
|
# Définir l'action d'erreur pour continuer silencieusement
|
|
$ErrorActionPreference = "SilentlyContinue"
|
|
|
|
# Bibliothèques de fonctions requises
|
|
|
|
#----------------------------------------------------------[Declarations]----------------------------------------------------------
|
|
# Version Script
|
|
$sScriptVersion = "1.0"
|
|
|
|
#Log File Info
|
|
$sLogPath = "C:\Tmp"
|
|
$sLogName = "<script_name>.log"
|
|
$sLogFile = Join-Path -Path $sLogPath -ChildPath $sLogName
|
|
|
|
Start-Transcript -Path $sLogFile -NoClobber
|
|
|
|
# Initial state
|
|
$ExitCode = 0
|
|
|
|
#-----------------------------------------------------------[Functions]------------------------------------------------------------
|
|
|
|
#--------------------------------------------------------[Debut Du Script]---------------------------------------------------------
|
|
|
|
# Get the status
|
|
$LbfoTeamMemberOutput = Get-NetLbfoTeamMember | Select-Object Name,FailureReason,Team
|
|
$LbfoTeamMemberCount = (Get-NetLbfoTeamMember).Count
|
|
|
|
# Normal state : AdministrativeDecision / NoFailure
|
|
Foreach($Member in $LbfoTeamMemberOutput) {
|
|
If(!(($Member.FailureReason -eq "NoFailure") -or ($Member.FailureReason -eq "AdministrativeDecision"))) {
|
|
$ExitCode = 2
|
|
Write-Output "CRITICAL: Member $($Member.Name) of the team $($Member.Team) state is $($Member.FailureReason)"
|
|
}
|
|
}
|
|
|
|
# Evaluate final exit code result for all passed checks.
|
|
If ($ExitCode -eq 0) {
|
|
Write-Output "OK: Members ($LbfoTeamMemberCount) of all LBFO teams are OK"
|
|
}
|
|
|
|
exit $ExitCode
|
|
|
|
#---------------------------------------------------------[Fin Du Script]----------------------------------------------------------
|
|
|
|
Stop-Transcript |