$InputFiles = Get-Item "*\*.config","*\*.xml"
$OldString  = '[client]'
$NewString  = $args[0]
$InputFiles | ForEach {
    (Get-Content -Path $_.FullName).Replace($OldString,$NewString) | Set-Content -Path $_.FullName
}

dir -Directory | ForEach {
    $Name = $_.Name
    cd $Name
    $ServiceName = $Name -replace '\s',''
    $ServicePath = Get-Item *Service.exe,*Host.exe|Select-Object -First 1 -ExpandProperty FullName
    New-Service -DisplayName "$Name" -Name "$ServiceName" -BinaryPathName "$ServicePath" -StartupType automatic
    Start-Service -Name $ServiceName -PassThru |Format-List
    cd ..
}

Write-Output "URLS"
Write-Output "======="
gci "*/*.config","*/*.xml" |Get-Content | sls -Pattern "https://$($NewString).*\.svc" |select-object -ExpandProperty Matches| Select-Object -ExpandProperty Value|Get-Unique