-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSGraphRequest.psm1
28 lines (25 loc) · 1.02 KB
/
MSGraphRequest.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
<#
.SYNOPSIS
Script that initiates the MSGraphRequest module
.NOTES
Author: Nickolaj Andersen & Jan Ketil Skanke
Contact: @NickolajA & @JankeSkanke
Website: https://www.msendpointmgr.com
#>
[CmdletBinding()]
param()
process {
# Locate all the public and private function specific files
$PublicFunctions = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath "Public") -Filter "*.ps1" -ErrorAction SilentlyContinue
$PrivateFunctions = Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath "Private") -Filter "*.ps1" -ErrorAction SilentlyContinue
# Dot source the function files
foreach ($FunctionFile in @($PublicFunctions + $PrivateFunctions)) {
try {
. $FunctionFile.FullName -ErrorAction Stop
}
catch [System.Exception] {
Write-Error -Message "Failed to import function '$($FunctionFile.FullName)' with error: $($_.Exception.Message)"
}
}
Export-ModuleMember -Function $PublicFunctions.BaseName -Alias *
}