NFSv3ExtendedGroups.psm1
Write-Host "Importing NFSv3ExtendedGroups..." # Path of log file is defined as global variable. $Global:NFSv3ExtendedGroupsLogFile = "$PSScriptRoot\NFSv3ExtendedGroupsLog.txt" # List of required modules $requiredModules = @('ActiveDirectory','FreeLDAP', 'Az.Storage') $missingModules = @() # Import required modules if they are not already loaded. foreach ($module in $requiredModules) { if (-not (Get-Module -ListAvailable -Name $module)) { $missingModules += $module } } # If there are missing modules, output an error and terminate. if ($missingModules.Count -gt 0) { foreach ($missingModule in $missingModules) { Write-Error "Required module '$missingModule' is not installed." } return } # If all modules are available, import them. foreach ($module in $requiredModules) { Import-Module -Name $module -ErrorAction Stop } # Dot source all the scripts. . $PSScriptRoot\Scripts\Write-NFSv3ExtendedGroupsLog.ps1 . $PSScriptRoot\Scripts\Sync-NFSv3ExtendedGroupsFromAD.ps1 . $PSScriptRoot\Scripts\Sync-NFSv3ExtendedGroupsFromLDAP.ps1 . $PSScriptRoot\Scripts\Sync-NFSv3ExtendedGroupsFromFlatFile.ps1 . $PSScriptRoot\Scripts\Get-NFSv3ExtendedGroups.ps1 . $PSScriptRoot\Scripts\Get-NFSv3UsersOfExtendedGroups.ps1 . $PSScriptRoot\Scripts\Remove-NFSv3ExtendedGroups.ps1 # Export all the member cmdlets of the module. # These cmdlets will be available externally. Export-ModuleMember -Function Sync-NFSv3ExtendedGroupsFromAD, Sync-NFSv3ExtendedGroupsFromLDAP, Sync-NFSv3ExtendedGroupsFromFlatFile, Get-NFSv3ExtendedGroups, Get-NFSv3UsersOfExtendedGroups, Remove-NFSv3ExtendedGroups |