- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Update MSServer Options with REST API in Powershell
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2019 05:23 AM - edited 07-08-2019 05:24 AM
Hello,
I want to update the options for msserver:dhcp and msserver:dns via powershell, for example login_name, login_password, synchronization_interval but it doesn't work, looks like I missed something in the options.
$msserver_options = @{ synchronization_interval="10"} $body = $msserver_options | ConvertTo-Json $uri_msdhcp = "$($ib_uri_base)/msserver:dhcp/ZG5zLm1zX3NlcnZlcl9kaGNwX3Byb3BlcnRpZXMkMA:10.0.0.1?_return_as_object=1" Invoke-RestMethod -Uri $uri_msdhcp -Method PUT -WebSession $ib_session -ContentType 'application/json' -Body $body
Error Message
Invoke-RestMethod : Der Remoteserver hat einen Fehler zurückgegeben: (400) Ungültige Anforderung.
In Zeile:7 Zeichen:1
+ Invoke-RestMethod -Uri $uri_msdhcp -Method PUT -WebSession $ib_session -ContentT ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
the GET command works fine and give me the correct result, I also tryed to another PUT command to update the name of a fixed address which also works fine.
GET ms-dhcp
$uri_msdhcp = "$($ib_uri_base)/msserver:dhcp/ZG5zLm1zX3NlcnZlcl9kaGNwX3Byb3BlcnRpZXMkMA:10.0.0.1?_return_fields=synchronization_interval&_return_type=json" Invoke-WebRequest -Uri $uri_msdhcp -Method Get -WebSession $ib_session
StatusCode : 200
StatusDescription : OK
Content : {"_ref": "msserver:dhcp/ZG5zLm1zX3NlcnZlcl9kaGNwX3Byb3BlcnRpZXMkMA:10.0.0.1", "synchronization_interval": 2}
thanks in advance
Andreas
Re: Update MSServer Options with REST API in Powershell
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2019 12:20 AM
Hi,
An integer is expected for synchronization_interval. Could you please remove the quotes around 10 and try again?
Thanks and regards,
Krishna
Re: Update MSServer Options with REST API in Powershell
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2019 07:23 AM
Hi Krishna,
I tryed this already but get the same error message
$msserver_options = @{
synchronization_interval=10}
$body = $msserver_options | ConvertTo-Json
kind regards,
Andreas
Re: Update MSServer Options with REST API in Powershell
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 12:15 AM - edited 08-14-2019 12:15 AM
I tried the new NIOS version 8.4.4 with the new WAPI version v2.10.3 because new features for MS Servers are implemented (RFE-9632) but still get the same error 400.
Re: Update MSServer Options with REST API in Powershell
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 09:33 AM
A whole number is normal for synchronization_interval. Would you be able to please eliminate the statements around 10 and attempt once more?
Re: Update MSServer Options with REST API in Powershell
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 11:48 AM
you can check this too from more help