Functions/Set-PARComponentConfig.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
Function Set-PARComponentConfig { <# .SYNOPSIS Sets values set in component configuration files .DESCRIPTION Sets values contained in component configuration files DBPARM.ini or PADR.ini on remote vault server. .PARAMETER Server The name or address of the remote Vault server to target with PARClient .PARAMETER Password The password for remote operations via PARClient as a secure string .PARAMETER Credential The password for remote operations via PARClient held in a credential object .PARAMETER PassFile The path to a "password" file created by PARClient.exe, containing the encrypted password value used for remote operations via PARClient .PARAMETER Component The name of the component to query. Vault or PADR are the accepted values .PARAMETER Parameter The name of the Parameter to set the value for. For Vault Components, valid parameter names are: "DefaultTimeout", "MTU", "SecurityNotification", "DebugLevel", "DisableExceptionHandling" For Disaster Recovery Components, valid parameter names are: "EnableCheck", "EnableReplicate", "EnableFailover", "EnableDBSync", "FailoverMode" .PARAMETER Value The value to set for the parameter in the configuration file .PARAMETER Mode Specify how or when the paramater value change will take effect. For Vault parameter value changes "Temporary", "Permanent" or "Immediate" modes can be specified. For Disaster Recovery parameter value changes only "Permanent" mode can be specified. .EXAMPLE Set-PARComponentConfig -Server EPV1 -Credential $credential -Component Vault -Parameter DefaultTimeout -Value 300 #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "ShouldProcess handling is in Invoke-PARClient")] Param( [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [string]$Server, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "Password" )] [securestring]$Password, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "Credential" )] [pscredential]$Credential, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateSet("Vault", "PADR")] [string]$Component, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True, ParameterSetName = "PassFile" )] [string]$PassFile, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateSet("DefaultTimeout", "MTU", "SecurityNotification", "DebugLevel", "DisableExceptionHandling", "EnableCheck", "EnableReplicate", "EnableFailover", "EnableDBSync", "FailoverMode")] [string]$Parameter, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [string]$Value, [Parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateSet("Temporary", "Permanent", "Immediate")] [string]$Mode ) Process { $PSBoundParameters.Add("CommandParameters", "SetParm $Component $Parameter=$Value /$Mode") $Result = Invoke-PARClient @PSBoundParameters If($Result.StdOut) { $Update = ($Result.StdOut | Select-String '(success|Error)' -AllMatches) [PSCustomObject]@{ "Server" = $Result.Server "Component" = $Component "Parameter" = $($PSBoundParameters["Parameter"]) "Value" = $Value "Mode" = $($PSBoundParameters["Mode"]) "Status" = $($Update.Matches.Groups[1].Value).Substring(0, 1).ToUpper() + $($Update.Matches.Groups[1].Value).Substring(1) "Message" = $Result.StdOut } } } } |