-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathM365UserOffboarding.psm1
More file actions
46 lines (42 loc) · 1.75 KB
/
Copy pathM365UserOffboarding.psm1
File metadata and controls
46 lines (42 loc) · 1.75 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
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# M365UserOffboarding.psm1 — Root module
# Dot-sources all private functions then exports public ones.
#
$script:ModuleRoot = $PSScriptRoot
$script:AuditLog = [System.Collections.Generic.List[PSCustomObject]]::new()
$script:ServerStop = $false
$script:Connected = $false
$script:TenantName = ''
$script:TenantId = ''
$script:ConnectedAs = ''
$script:HasIntuneLicense = $false
# Cursor cache for Graph user pagination (keyed by "$search|$pageNumber" → nextLink URL)
$script:UserPageCursors = @{}
# ── Private functions ─────────────────────────────────────────────────────────
$privatePatterns = @(
"$PSScriptRoot\Private\Auth\*.ps1",
"$PSScriptRoot\Private\Server\*.ps1",
"$PSScriptRoot\Private\Api\*.ps1",
"$PSScriptRoot\Private\Actions\*.ps1",
"$PSScriptRoot\Private\Logging\*.ps1"
)
foreach ($pattern in $privatePatterns) {
foreach ($file in (Get-ChildItem -Path $pattern -ErrorAction SilentlyContinue)) {
try {
. $file.FullName
}
catch {
Write-Warning "Failed to load private function from $($file.Name): $_"
}
}
}
# ── Public functions ──────────────────────────────────────────────────────────
# FunctionsToExport in the module manifest is the authoritative export list.
foreach ($file in (Get-ChildItem -Path "$PSScriptRoot\Public\*.ps1" -ErrorAction SilentlyContinue)) {
try {
. $file.FullName
}
catch {
Write-Warning "Failed to load public function from $($file.Name): $_"
}
}