-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFunctions-Titles-Write-Color.ps1
49 lines (39 loc) · 1.1 KB
/
Functions-Titles-Write-Color.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Function Title1 ($title, $TotalLength = 100, $Back = "Yellow", $Fore = "Black") {
$TitleLength = $Title.Length
[string]$StarsBeforeAndAfter = ""
$RemainingLength = $TotalLength - $TitleLength
If ($($RemainingLength % 2) -ne 0) {
$Title = $Title + " "
}
$Counter = 0
For ($i=1;$i -le $(($RemainingLength)/2);$i++) {
$StarsBeforeAndAfter += "*"
$counter++
}
$Title = $StarsBeforeAndAfter + $Title + $StarsBeforeAndAfter
Write-host
Write-Host $Title -BackgroundColor $Back -foregroundcolor $Fore
Write-Host
}
Function LogMag ($Message){
Write-Host $message -ForegroundColor Magenta
}
Function LogGreen ($message){
Write-Host $message -ForegroundColor Green
}
Function LogYellow ($message){
Write-Host $message -ForegroundColor Yellow
}
Function LogBlue ($message){
Write-Host $message -ForegroundColor Blue
}
#Examples
cls
Title1 "Part 1 - Checking mailboxes"
For ($i=0;$i -le 10;$i++){
LogGreen "Mailbox $i - ok"
}
Title1 "Part 2 - Checking databases"
For ($i=0;$i -le 5;$i++){
LogGreen "Database $i - ok"
}