× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Remote shutdown on OS 6?

nappa
Aspirant

Remote shutdown on OS 6?

Is there a way to do a remote shutdown on OS 6?
I found this for older versions: viewtopic.php?p=94750
but nothing for OS 6.
Message 1 of 8
chirpa
Luminary

Re: Remote shutdown on OS 6?

They switched to XML.

This should work:

curl -u admin:password -k "https://IP_OF_NAS/dbbroker" -H "Content-Type: application/x-www-form-urlencoded;" -H "X-Requested-With: XMLHttpRequest" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?>             <xs:nml xmlns:xs=\"http://www.netgear.com/protocol/transaction/NMLSchema-0.9\" xmlns=\"urn:netgear:nas:readynasd\" src=\"dpv_1368497621000\" dst=\"nas\">                <xs:transaction id=\"njl_id_1278\">                    <xs:custom id=\"njl_id_1277\" name=\"Halt\" resource-id=\"Shutdown\" resource-type=\"System\">                    <Shutdown halt=\"true\" fsck=\"false\"/>                </xs:custom>                </xs:transaction>            </xs:nml>"
Message 2 of 8
chirpa
Luminary

Re: Remote shutdown on OS 6?

Easy way to sniff XML for ReadyNAS via Google Chrome browser...

Open Dashboard, then in Chrome choose Tools>Developer Tools. Click on the Network tab in that Inspector. It will show you all network calls. Run the command you want, and find the related dbbroker call for it. You can then 'Copy to curl' in the right-click menu to get a working curl call for it.
Message 3 of 8
nappa
Aspirant

Re: Remote shutdown on OS 6?

Works perfectly. Thank you!

Great tip about the network inspector in Chrome, too. Very convenient. And here I was looking for the call in javascript.

Thanks again!
Message 4 of 8
ciarpame
Tutor

Re: Remote shutdown on OS 6?

Thank you very much chirpa, I was able to find the Chrome way by myself but I was missing the right CURL syntax.

My Readynas is a NV+ V2 so I suppose is OS5. Anyway xml syntax is almost identical. This is my working CURL command (xml captured with chrome dev tools):

curl -s -v -u admin:password -k "https://IP_OF_NAS/dbbroker" -H "Content-Type: application/x-www-form-urlencoded;" -H "X-Requested-With: XMLHttpRequest" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?>             <xs:nml xmlns:xs=\"http://www.netgear.com/protocol/transaction/NMLSchema-0.9\" xmlns=\"urn:netgear:nas:readynasd\" src=\"dpv_1389313459000\" dst=\"nas\">                <xs:transaction id=\"njl_id_725\">                    <xs:custom id=\"njl_id_724\" name=\"Halt\" resource-id=\"Shutdown\" resource-type=\"System\">                    <Shutdown halt=\"true\" fsck=\"false\"/>                </xs:custom>                </xs:transaction>            </xs:nml>"
Message 5 of 8
Shri-Ganesh
Tutor

Re: Remote shutdown on OS 6?

For the 6.4.0 OS:

 

curl -u admin: password -k "https://IP_OF_NAS/dbbroker" -H "Content-Type: application/x-www-form-urlencoded;" -H "X-Requested-With: XMLHttpRequest" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xs:nml xmlns:xs=\"http://www.netgear.com/protocol/transaction/NMLSchema-0.9\" xmlns=\"urn:netgear:nas:readynasd\" src=\"dpv_1445852944000\" dst=\"nas\"><xs:transaction id=\"njl_id_2269\"><xs:custom id=\"njl_id_2268\" name=\"Halt\" resource-id=\"Shutdown\" resource-type=\"System\"><Shutdown halt=\"true\" fsck=\"false\"/></xs:custom></xs:transaction></xs:nml>"
Message 6 of 8
Sandshark
Sensei

Re: Remote shutdown on OS 6?

How about directly from PowerShell instead of having to install cURL?    How would one convert all of those cURL options into a PowerShell Invoke-RestMethod CmdLet?

Message 7 of 8
InteXX
Luminary

Re: Remote shutdown on OS 6?

This is a little bit late, but here's how to do it in PowerShell 3+:

 

$Hostname = "readynas"
$Username = "username"
$Password = ConvertTo-SecureString "password" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($Username, $Password)
$Headers = @{ "Content-Type" = "application/x-www-form-urlencoded"; "X-Requested-With" = "XMLHttpRequest" }
$Xml = '<?xml version="1.0" encoding="UTF-8"?><xs:nml xmlns:xs="http://www.netgear.com/protocol/transaction/NMLSchema-0.9" xmlns="urn:netgear:nas:readynasd" src="dpv_1368497621000" dst="nas"><xs:transaction id="njl_id_1278"><xs:custom id="njl_id_1277" name="Halt" resource-id="Shutdown" resource-type="System"><Shutdown halt="true" fsck="false"/></xs:custom></xs:transaction></xs:nml>'
$Uri = "https://$Hostname/dbbroker"

Add-Type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Invoke-RestMethod -Credential $Credential -Headers $Headers -Uri $Uri -Method Post -Body $Xml
Message 8 of 8
Top Contributors
Discussion stats
  • 7 replies
  • 9814 views
  • 1 kudo
  • 6 in conversation
Announcements