If you have many clients that are configured to skywats.com instead of wats.com, you can automate the change by running the following Powershell script:
# Define the path to the JSON file
$jsonFilePath = "C:\ProgramData\Virinco\WATS\settings.json"
# Define the path for the backup file
$backupFilePath = "$jsonFilePath.bak"
# Read the content of the JSON file
$jsonContent = Get-Content -Path $jsonFilePath -Raw | ConvertFrom-Json
# Modify the TargetURL
$oldDomain = "skywats.com"
$newDomain = "wats.com"
$targetURL = $jsonContent.TargetURL
# Check if the URL already has the correct domain
if ($targetURL -like "*.$newDomain*") {
Write-Output "Already set to $targetURL"
} else {
# Create a backup of the original JSON file
Copy-Item -Path $jsonFilePath -Destination $backupFilePath
# Update the TargetURL
$updatedTargetURL = $targetURL -replace $oldDomain, $newDomain
$jsonContent.TargetURL = $updatedTargetURL
# Convert the JSON object back to a string
$jsonString = $jsonContent | ConvertTo-Json -Compress
# Write the updated JSON back to the file
$jsonString | Set-Content -Path $jsonFilePath
# Display a confirmation message
Write-Output "Changed WATS Client settings from $targetURL to $updatedTargetURL"
}
Comments
0 comments
Please sign in to leave a comment.