-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCommon.ps1
More file actions
33 lines (29 loc) · 1.15 KB
/
Common.ps1
File metadata and controls
33 lines (29 loc) · 1.15 KB
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
# =====================================================================================================
# Common functions...
# -----------------------------------------------------------------------------------------------------
# Modified By: Siôn Lewis (www.sjlewis.com)
# Modified Date: 18/05/2024
# =====================================================================================================
#
# Reads the input of of either [y] Yes | [n] No and returns either $true or $false.
# -----------------------------------------------------------------------------------------------------
# Read-Confirmation -Message "Are you sure you want to proceed? [y] Yes | [n] No";
#
function Read-Confirmation {
param (
[string]$Message = "Are you sure you want to proceed? [y] Yes | [n] No"
)
[bool]$output = $false;
[string]$confirmation = Read-Host $Message;
if ($confirmation -eq 'y') {
$output = $true;
}
elseif ($confirmation -eq 'n') {
$output = $false;
}
else {
Write-Host "Please enter either [y] Yes or [n] No."
$output = Read-Confirmation -Message $Message;
}
return $output;
}