PatchHelper.psm1
function Get-PatchHelperConfig { if (!((Get-Variable -scope Script PatchHelperConfig -ErrorAction SilentlyContinue) -and $PatchHelperConfig)) { Set-Variable -scope Script -Name PatchHelperConfig -Value @{ "ReportURL" = "" "CustomerName" = "" "DefaultInstance" = "" "DefaultPatchFolder" = "" } $PatchHelperConfigFile = Join-Path "$Env:ProgramData\ADSPatchHelper" "PatchHelper.config.json" 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." } } Export-ModuleMember -Variable PatchHelperConfig } return $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 "Extension\Upgrade-Extensions.ps1") |