PartnerCenter.psm1
# # Script module for module 'PartnerCenter' that is executed when 'PartnerCenter' is imported in a PowerShell session. # # Generated by: Microsoft Corporation # # Generated on: 04/04/2020 # $PSDefaultParameterValues.Clear() Set-StrictMode -Version Latest function Test-DotNet { try { if ((Get-PSDrive 'HKLM' -ErrorAction Ignore) -and (-not (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\' -ErrorAction Stop | Get-ItemPropertyValue -ErrorAction Stop -Name Release | Where { $_ -ge 461808 }))) { throw ".NET Framework versions lower than 4.7.2 are not supported by the Partner Center module. Please upgrade to .NET Framework 4.7.2 or higher." } } catch [System.Management.Automation.DriveNotFoundException] { Write-Verbose ".NET Framework version check failed." } } if ($true -and ($PSEdition -eq 'Desktop')) { if ($PSVersionTable.PSVersion -lt [Version]'5.1') { throw "PowerShell versions lower than 5.1 are not supported by the Partner Center module. Please upgrade to PowerShell 5.1 or higher." } Test-DotNet } if (Test-Path -Path "$PSScriptRoot\StartupScripts" -ErrorAction Ignore) { Get-ChildItem "$PSScriptRoot\StartupScripts" -ErrorAction Stop | ForEach-Object { . $_.FullName } } $preloadPath = (Join-Path $PSScriptRoot -ChildPath "PreloadAssemblies") if($PSEdition -eq 'Desktop' -and (Test-Path $preloadPath -ErrorAction Ignore)) { try { Get-ChildItem -ErrorAction Stop -Path $preloadPath -Filter "*.dll" | ForEach-Object { Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null } } catch {} } $netCorePath = (Join-Path $PSScriptRoot -ChildPath "NetCoreAssemblies") if($PSEdition -eq 'Core' -and (Test-Path $netCorePath -ErrorAction Ignore)) { try { $loadedAssemblies = ([System.AppDomain]::CurrentDomain.GetAssemblies() | %{New-Object -TypeName System.Reflection.AssemblyName -ArgumentList $_.FullName} ) Get-ChildItem -ErrorAction Stop -Path $netCorePath -Filter "*.dll" | ForEach-Object { $assemblyName = ([System.Reflection.AssemblyName]::GetAssemblyName($_.FullName)) $matches = ($loadedAssemblies | Where-Object {$_.Name -eq $assemblyName.Name}) if (-not $matches) { Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null } } } catch {} } Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Store.PartnerCenter.PowerShell.dll) if (Test-Path -Path "$PSScriptRoot\PostImportScripts" -ErrorAction Ignore) { Get-ChildItem "$PSScriptRoot\PostImportScripts" -ErrorAction Stop | ForEach-Object { . $_.FullName } } |