OmadaSqlTroubleShooter.psm1
|
####################################################################################################################################################### # WARNING: DO NOT EDIT THIS FILE AS IT IS GENERATED AND WILL BE OVERWRITTEN ON THE NEXT UPDATE! # # # # Generated via psake on: 2026-09-02T05:51:59.105Z # # Version: 2026.9.2.78 # # Copyright Fortigi (C) 2024-2026 # ####################################################################################################################################################### #requires -Version 7.0 [CmdLetBinding()] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'WebViewInstalled', Justification = 'The variable is used, but script analyzer does not recognize it')] param() try { $Script:Tracer = [System.Diagnostics.Trace] $Script:Tracer::AutoFlush = $true $ModuleName = "OmadaSqlTroubleshooter" "Loading {0} Module" -f $ModuleName | Write-Verbose $Script:ModuleVersion = "2026.09.02.78" $MinimumOmadaWebPSVersion = "2026.07.09.9" if ($MinimumOmadaWebPSVersion -ne "0.0") { Import-Module OmadaWeb.PS -MinimumVersion $MinimumOmadaWebPSVersion -ErrorAction Stop if ((Get-Module -Name OmadaWeb.PS).Version -lt [version]$MinimumOmadaWebPSVersion) { throw ("OmadaWeb.PS module version {0} or higher is required." -f $MinimumOmadaWebPSVersion) } } $Script:DependencyLockPath = Join-Path $PSScriptRoot -ChildPath "DependencyLock.psd1" $LocalAppDataPath = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::LocalApplicationData) $Script:ModuleAppDataPath = (New-Item (Join-Path $LocalAppDataPath -ChildPath $ModuleName) -ItemType Directory -Force).FullName $BinPath = (New-Item (Join-Path $Script:ModuleAppDataPath -ChildPath "Bin") -ItemType Directory -Force).FullName if (-not (Test-Path "$PSScriptRoot\Lib\Functions\Public" -PathType Container)) { $Public = @(Get-ChildItem "$PsscriptRoot\Lib\Functions\Functions.ps1") } else { $Public = @(Get-ChildItem -Path $PSScriptRoot\Lib\Functions\Public\*.ps1 -Recurse | Where-Object { $_.Name -notlike "_*.ps1" }) } if (-not(Test-Path "$PSScriptRoot\Lib\Functions\Private" -PathType Container)) { $Private = @() } else { $Private = @(Get-ChildItem -Path $PSScriptRoot\Lib\Functions\Private\*.ps1 -Recurse | Where-Object { $_.Name -notlike "_*.ps1" }) } foreach ($Import in @($Public + $Private)) { try { . $Import.FullName } catch { "Failed to import function {0}: {1}" -f $($Import.FullName), $_ | Write-Error -ErrorAction "Stop" } } try { $WebBinBasePath = New-Item $BinPath -ItemType Directory -Force } catch {} "{0} - Set paths" -f $MyInvocation.MyCommand | Write-Verbose if ($Env:PROCESSOR_ARCHITECTURE -eq "AMD64") { $WebView2BasePath = [System.IO.Path]::Combine($WebBinBasePath, "win-x64") } else { $WebView2BasePath = [System.IO.Path]::Combine($WebBinBasePath, "win-x86") } New-Item -ItemType Directory -Path $WebView2BasePath -Force | Out-Null $Script:WebView2CorePath = [System.IO.Path]::Combine($WebView2BasePath, "Microsoft.Web.WebView2.Core.dll") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2CorePath | Write-Verbose $Script:WebView2WinFormsPath = [System.IO.Path]::Combine($WebView2BasePath, "Microsoft.Web.WebView2.WinForms.dll") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2WinFormsPath | Write-Verbose $Script:WebView2WpfPath = [System.IO.Path]::Combine($WebView2BasePath, "Microsoft.Web.WebView2.Wpf.dll") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2WpfPath | Write-Verbose $Script:WebView2LoaderPath = [System.IO.Path]::Combine($WebView2BasePath, "WebView2Loader.dll") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2LoaderPath | Write-Verbose $Script:WebView2StampPath = [System.IO.Path]::Combine($WebView2BasePath, "WebView2.pin") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2StampPath | Write-Verbose $Script:WebView2UserProfileBasePath = [System.IO.Path]::Combine($Script:ModuleAppDataPath, "Edge User Data") $Script:WebView2UserProfilePath = [System.IO.Path]::Combine($Script:ModuleAppDataPath, "Edge User Data\OmadaWebView2Profile") "{0} - {1}" -f $MyInvocation.MyCommand, $Script:WebView2UserProfilePath | Write-Verbose $WebViewInstalled = Install-WebView2 -IncludeWpf if (!$WebViewInstalled) { "Cannot start module because the Microsoft Edge Webview2 RunTime was not found. You can download it from: https://developer.microsoft.com/en-us/microsoft-edge/webview2?form=MA13LH#download-section. When you are not able to install it, you can also add the Webview2 Fixed Version binaries to folder {0}" -f (Join-Path $WebBinBasePath -ChildPath "$ModuleName\bin\Webview2Runtime") | Write-Error -ErrorAction "Stop" } "Validate version" | Write-Verbose Show-ModuleUpdateNotification -ModuleName $ModuleName Test-Shortcut } catch { throw } |