-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEguibarIT.psm1
60 lines (52 loc) · 2.06 KB
/
EguibarIT.psm1
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
50
51
52
53
54
55
56
57
58
59
60
# Get Enums
if (Test-Path -Path "$PSScriptRoot\Enums") {
$Enums = @( Get-ChildItem -Path "$PSScriptRoot\Enums\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse )
# Import Enums
foreach ($Item in $Enums) {
Try {
. $Item.FullName
Write-Verbose -Message ('Enum Imported {0}' -f $($Item.BaseName))
} Catch {
Write-Error -Message "Could not load Enum [$($Item.Name)] : $($_.Message)"
throw
} #end Try-Catch
} #end Foreach
} #end If
# Get Classes
if (Test-Path -Path "$PSScriptRoot\Classes") {
$Classes = @( Get-ChildItem -Path "$PSScriptRoot\Classes\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse )
foreach ($Item in $Classes) {
Try {
. $Item.FullName
Write-Verbose -Message ('Class Imported {0}' -f $($Item.BaseName))
} Catch {
Write-Error -Message "Could not load Class [$($Item.Name)] : $($_.Message)"
throw
} #end Try-Catch
} #end Foreach
} #end If
# Load Private Functions
$Private = @( Get-ChildItem -Path "$PSScriptRoot\Private\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse )
foreach ($Item in $Private) {
Try {
. $Item.Fullname
Write-Verbose -Message ('Private Function Imported {0}' -f $($Item.BaseName))
} Catch {
Write-Error -Message "Failed to import private function from $($Item.Fullname): $($_.Exception.Message)"
Throw
}
}
# Load Public Functions
$Public = @( Get-ChildItem -Path "$PSScriptRoot\Public\" -Filter *.ps1 -ErrorAction SilentlyContinue -Recurse )
foreach ($Item in $Public) {
Try {
. $Item.Fullname
Write-Verbose -Message ('Public Function Imported {0}' -f $($Item.BaseName))
} Catch {
Write-Error -Message "Failed to import public function from $($Item.Fullname): $($_.Exception.Message)"
Throw
}
}
Export-ModuleMember -Function '*' -Alias '*'
# Call function Initialize-ModuleVariable to fill-up $Variables
Initialize-ModuleVariable