I am trying to update the ouput directory of a service via powershell. Long story short domain changed and only have a few hundred to do. I get the following error when running the script "status": "error", "messages": ["Use JSON in parameter service."], "code": 500
$editServiceUrl = "https://<myserverdomain>//server/admin/services/Hosted/<myFeatureClass>.FeatureService/edit"
updateBody = @{
"outputDir:" "\\server.domain.com\arcgisserver\arcgisoutput"
# I have also tried "outputDir:" "\\\\server.domain.com\\arcgisserver\\arcgisoutput"
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri $editServiceUrl -Method Post -Body $updateBody -Headers @{
"Authorization" = "Bearer $token"
} -ContentType "application/x-www-form-urlencoded"
I have not tried to update services this way before. I can publish/delete services no issues (I know not apples to apples) .
Is it my formatting of the json string or do I have to update the entire service properties with just the one change?