PatchHelper.psm1
<#
.SYNOPSIS Returnes currently loaded configuration of PatchHelper. If configuration is not loaded then reads it from file. #> function Get-PatchHelperConfig { [CmdletBinding()] param() $PatchHelperConfigFile = Join-Path "$Env:ProgramData\ADSPatchHelper" "PatchHelper.config.json" if (!((Get-Variable -scope Script PatchHelperConfig -ErrorAction SilentlyContinue) -and $PatchHelperConfig)) { Set-Variable -scope Script -Name PatchHelperConfig -Value @{ "ReportURL" = "" "CustomerName" = "" "DefaultInstance" = "" "DefaultPatchFolder" = "" "LayerName" = "" "Apps" = "" "Version" = '1.2' } if (Test-Path $PatchHelperConfigFile) { try { $savedConfig = Get-Content $PatchHelperConfigFile | ConvertFrom-Json if ("$savedConfig") { $keys = $PatchHelperConfig.Keys | % { $_ } $keys | % { if ($savedConfig.PSObject.Properties.Name -eq "$_") { Write-Verbose "Setting $_ = $($savedConfig."$_")" $PatchHelperConfig."$_" = $savedConfig."$_" } } } } catch { Write-Warning "Error reading configuration file $PatchHelperConfigFile. Please run Configure-PatchHelper again." } } $PatchHelperConfig = [PSCustomObject]$PatchHelperConfig Export-ModuleMember -Variable PatchHelperConfig } Write-Verbose $PatchHelperConfigFile return $PatchHelperConfig } Export-ModuleMember -Function "Get-PatchHelperConfig" Get-PatchHelperConfig | Out-Null . (Join-Path $PSScriptRoot "Patch\Register-PatchHelper.ps1") # . (Join-Path $PSScriptRoot "Patch\Send-PatchInfo.ps1") . (Join-Path $PSScriptRoot "Patch\Install-Patch.ps1") . (Join-Path $PSScriptRoot "Patch\Install-Release.ps1") . (Join-Path $PSScriptRoot "Patch\Get-PatchInfo.ps1") # . (Join-Path $PSScriptRoot "Patch\Invoke-AutoUpdate.ps1") . (Join-Path $PSScriptRoot "Extension\Upgrade-Extensions.ps1") |