-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImport-AzureModules.ps1
36 lines (31 loc) · 1.18 KB
/
Import-AzureModules.ps1
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
# Function to check path and import module if exists
function Import-ModuleIfExists {
param (
[string]$modulePath,
[string]$moduleName
)
if (Test-Path $modulePath) {
Write-Output "Importing module: $moduleName"
Import-Module $modulePath -Force
} else {
Write-Output "Module not found: $moduleName at path: $modulePath"
}
}
# Define paths to modules
$modulesToCheck = @{
"TokenTactics" = "C:\Git\TokenTactics\TokenTactics.psm1"
"GraphRunner" = "C:\Git\GraphRunner\GraphRunner.ps1"
"PowerZure" = "C:\Git\CARTP\Tools\PowerZure\PowerZure.psm1"
"MicroBurst-Misc" = "C:\Git\CARTP\Tools\MicroBurst\Misc\MicroBurst-Misc.psm1"
# "MicroBurst" = "C:\Git\CARTP\Tools\MicroBurst\MicroBurst.psm1"
}
# Check and import the modules
foreach ($module in $modulesToCheck.GetEnumerator()) {
Import-ModuleIfExists -modulePath $module.Value -moduleName $module.Key
}
# Import other required modules
$requiredModules = @("AADInternals", "Az", "AzureADPreview", "MSOnline", "Microsoft.Graph", "ExchangeOnlineManagement")
foreach ($module in $requiredModules) {
Write-Output "Importing module: $module"
Import-Module $module -Force
}