AzureAD.Standard.Preview.psm1
# # Script Module manifest for module 'AzureAD.Standard.Preview' # # Generated by: Microsoft Corporation # # Generated on: 01/24/2017 # Updated on: 03/20/2019 Set-StrictMode -Version Latest # Set up some helper variables to make it easier to work with the module $script:PSModule = $ExecutionContext.SessionState.Module $script:PSModuleDir = $script:PSModule.ModuleBase $script:ADAssemblyRoot = 'Microsoft.Open.Azure.AD.CommonLibrary.dll' $script:ADNestedAssemblies = @( 'Microsoft.Open.AzureAD16.Graph.PowerShell.dll', 'Microsoft.Open.AzureAD16.Graph.PowerShell.Custom.dll', 'Microsoft.Open.AzureAD16.Graph.Client.dll', 'Microsoft.Open.MS.GraphV10.PowerShell.Custom.dll', 'Microsoft.Open.MS.GraphV10.PowerShell.dll', 'Microsoft.Open.MS.GraphV10.Client.dll') # Try to import the AD assembly at the same directory regardless fullclr or coreclr $ADRootModulePath = Join-Path -Path $script:PSModuleDir -ChildPath $script:ADAssemblyRoot $BinaryModuleDir = $script:PSModuleDir if(-not (Test-Path -Path $ADRootModulePath)) { # Import the appropriate nested binary module based on the current PowerShell version if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -eq 'Desktop')) { $BinaryModuleDir = Join-Path -Path $script:PSModuleDir -ChildPath 'net471' Write-Debug -Message "Loading module in fullclr folder: 'net471' ..." }else{ $BinaryModuleDir = Join-Path -Path $script:PSModuleDir -ChildPath 'netstandard2.0' Write-Debug -Message "Loading module in coreclr folder: 'netstandard2.0' ..." } } # Load root assembly first $ADRootModulePath = Join-Path -Path $BinaryModuleDir -ChildPath $script:ADAssemblyRoot $ADRootModule = Import-Module -Name $ADRootModulePath -PassThru # Load all nested assemblies foreach($assembly in $script:ADNestedAssemblies) { $ADModulePath = Join-Path -Path $BinaryModuleDir -ChildPath $assembly Import-Module -Name $ADModulePath -PassThru } # When the module is unloaded, remove the nested binary module that was loaded with it if($ADRootModule) { $script:PSModule.OnRemove = { Remove-Module -ModuleInfo $ADRootModule } } |