-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMClient.psm1
More file actions
33 lines (21 loc) · 1.16 KB
/
Copy pathCMClient.psm1
File metadata and controls
33 lines (21 loc) · 1.16 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
#load configuration settings
$Global:Configuration = get-content "$($PSScriptRoot)\CMClient.conf" | Out-String | Convertfrom-JSON
#Load list of error codes
$Global:Configuration | Add-member -NotePropertyName ErrorCodes -NotePropertyValue $(import-csv "$($PSScriptRoot)\ErrorCodes.csv" -delimiter ';') -Force
# --- Expose each Public and Private function as part of the module
foreach ($PrivateFunction in Get-ChildItem -Path "$($PSScriptRoot)\Functions\Private\*.ps1" -Recurse -Verbose:$VerbosePreference) {
. $PrivateFunction.FullName
}
foreach ($Publicfunction in Get-ChildItem -Path "$($PSScriptRoot)\Functions\Public\*.ps1" -Recurse -Verbose:$VerbosePreference) {
. $PublicFunction.FullName
$BaseName = [System.IO.Path]::GetFileNameWithoutExtension($PublicFunction)
# --- Support DEPRECATED functions. Ensure that we are exporting only the function name
$DepricatedKeyword = "DEPRECATED-"
if ($BaseName.StartsWith($DepricatedKeyword)) {
$BaseName = $BaseName.Trim($DepricatedKeyword)
}
Export-ModuleMember -Function ($BaseName)
}
# --- Clean up variables on module removal
$ExecutionContext.SessionState.Module.OnRemove = {
}