Powershell for Changing AppSettings in Application Configuration File

Here is a PowerShell Function that I created with the objective of changing an application configuration file and then, if we want, restart a service   Function Set-ApplicationSettingConfigProperty { param ( [parameter(Mandatory = $true)][ValidateScript ({Test-Path $_})][string] $PathToConfigFile, [parameter(Mandatory = $true)][string] $PropertyName, [parameter(Mandatory = $true)][string] $PropertyValue, [Parameter(Mandatory = $false)][Validatescript ({(Get-Service $_) -ne $null})][string] $NameOfServiceToRestart = $null)…

1