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\WriteNFSv3ExtendedGroupsLog.ps1 . $PSScriptRoot\Scripts\SyncNFSv3ExtendedGroupsFromAD.ps1 . $PSScriptRoot\Scripts\SyncNFSv3ExtendedGroupsFromLDAP.ps1 . $PSScriptRoot\Scripts\SyncNFSv3ExtendedGroupsFromFlatFile.ps1 . $PSScriptRoot\Scripts\GetNFSv3ExtendedGroups.ps1 . $PSScriptRoot\Scripts\GetNFSv3UsersOfExtendedGroups.ps1 . $PSScriptRoot\Scripts\RemoveNFSv3ExtendedGroups.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 |